[MLton-commit] r5353

Vesa Karvonen vesak at mlton.org
Tue Feb 27 07:45:46 PST 2007


Added toList.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/misc-util/unstable/node.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/misc-util/unstable/node.sml
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/node.sml	2007-02-27 15:44:27 UTC (rev 5352)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/node.sml	2007-02-27 15:45:43 UTC (rev 5353)
@@ -68,6 +68,12 @@
    val fromList : 'a List.t -> 'a t
    (** Constructs an imperative list from a functional list. *)
 
+   val toList : 'a t -> 'a List.t
+   (**
+    * Returns a functional list containing the same elements as the imperative
+    * list.
+    *)
+
    val app : 'a Effect.t -> 'a t Effect.t
    (**
     * Applies the given effect to all elements of the imperative list.
@@ -148,6 +154,9 @@
         | SOME (y, t) =>
           foldl f (f (y, x)) t
 
+   fun toList n =
+       rev (foldl op :: [] n)
+
    fun app e =
        foldl (e o #1) ()
 




More information about the MLton-commit mailing list