CVS: sml/src/smlnj-lib/Util left-priorityq-fn.sml,1.3,1.4 mono-priorityq-sig.sml,1.1,1.2 parser-comb.sml,1.4,1.5
John Reppy <[email protected]>
| Newsgroups | gmane.comp.lang.sml.smlnj.commits |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/smlnj/sml/src/smlnj-lib/Util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11142/Util
Modified Files:
left-priorityq-fn.sml mono-priorityq-sig.sml parser-comb.sml
Log Message:
Added singleton function to MONO_PRIORITYQ interface.
Index: left-priorityq-fn.sml
===================================================================
RCS file: /cvsroot/smlnj/sml/src/smlnj-lib/Util/left-priorityq-fn.sml,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** left-priorityq-fn.sml 21 Feb 2002 15:28:03 -0000 1.3
--- left-priorityq-fn.sml 5 May 2005 16:48:44 -0000 1.4
***************
*** 17,21 ****
val empty = Q(0, EMPTY)
! fun singleton x = ND(1, x, EMPTY, EMPTY)
fun rank EMPTY = 0
--- 17,22 ----
val empty = Q(0, EMPTY)
! fun singletonHeap x = ND(1, x, EMPTY, EMPTY)
! fun singleton x = Q(1, singletonHeap x)
fun rank EMPTY = 0
***************
*** 34,38 ****
(* end case *))
! fun insert (x, Q(n, h)) = Q(n+1, mergeHeap(singleton x, h))
fun next (Q(_, EMPTY)) = NONE
--- 35,39 ----
(* end case *))
! fun insert (x, Q(n, h)) = Q(n+1, mergeHeap(singletonHeap x, h))
fun next (Q(_, EMPTY)) = NONE
***************
*** 50,57 ****
fun fromList [] = empty
! | fromList [x] = Q(1, singleton x)
| fromList l = let
fun init ([], n, items) = (n, items)
! | init (x::r, n, items) = init (r, n+1, singleton x :: items)
fun merge ([], [h]) = h
| merge ([], hl) = merge (hl, [])
--- 51,58 ----
fun fromList [] = empty
! | fromList [x] = Q(1, singletonHeap x)
| fromList l = let
fun init ([], n, items) = (n, items)
! | init (x::r, n, items) = init (r, n+1, singletonHeap x :: items)
fun merge ([], [h]) = h
| merge ([], hl) = merge (hl, [])
Index: mono-priorityq-sig.sml
===================================================================
RCS file: /cvsroot/smlnj/sml/src/smlnj-lib/Util/mono-priorityq-sig.sml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** mono-priorityq-sig.sml 12 Feb 2002 22:21:13 -0000 1.1
--- mono-priorityq-sig.sml 5 May 2005 16:48:44 -0000 1.2
***************
*** 16,19 ****
--- 16,22 ----
val empty : queue
+ val singleton : item -> queue
+ (* create a queue from a single item *)
+
val fromList : item list -> queue
(* build a queue from a list of items *)
Index: parser-comb.sml
===================================================================
RCS file: /cvsroot/smlnj/sml/src/smlnj-lib/Util/parser-comb.sml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** parser-comb.sml 4 May 2005 15:31:41 -0000 1.4
--- parser-comb.sml 5 May 2005 16:48:44 -0000 1.5
***************
*** 107,111 ****
(* end case *))
! fun join p = bind (p, fn SOME x => result x | NONE => failure)
(* parse a token consisting of characters satisfying the predicate.
--- 107,111 ----
(* end case *))
! fun join p = bind (p, fn (SOME x) => result x | NONE => failure)
(* parse a token consisting of characters satisfying the predicate.
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20