1 (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
7 (*-------------------------------------------------------------------*)
9 (*-------------------------------------------------------------------*)
11 functor ListQueue(): BASIC_PERSISTENT_QUEUE =
16 datatype 'a t = T of 'a List.t
21 | SOME(x, l) => SOME(x, T l)
23 fun empty () = T(L.empty())
25 fun isEmpty(T l) = L.isEmpty l
27 fun enque(T l, x) = T(L.append(l, L.single x))
31 structure ListQueue = PersistentQueue(ListQueue())