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
.
8 structure Q
= QueueLogarithmicExplicit();
9 fun p q
= Q
.output(q
, ", ", Int.output
, Out
.standard
);
10 let val q
= ref(Q
.empty())
11 in Iterate
.for(1, 20, fn n
=>
13 Out
.newline Out
.standard
;
14 q
:= Q
.enqueue(!q
,n
)))
18 structure Q
= QueuePersistentTwoList
20 structure Q
= Queue(QueuePersistentOrderOne())
23 val q
= Q
.empty(): int Q
.t
29 val q
= Q
.enqueue(Q
.enqueue(q
, 1), 2)
31 val (one
, q
') = Q
.dequeue q
33 val (two
, q
'') = Q
.dequeue q
'
40 functor Test
= QueueTest (structure ListUtil
= ListUtil
)
41 (structure Queue
= QueuePersistentList
) ;
43 structure Ephemeral
= Test(structure Queue
' = QueueEphemeral
)
44 structure PersistentTwoList
= Test(structure Queue
' = QueuePersistentTwoList
)
45 structure OrderOne
= Test(structure Queue
' = QueuePersistentOrderOne
)
49 val _
= (Ephemeral
.test numOps
;
50 PersistentTwoList
.test numOps
;