[MLton-commit] r5372

Vesa Karvonen vesak at mlton.org
Thu Mar 1 04:12:57 PST 2007


Curried push operations, because it simply is more convenient.

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

U   mltonlib/trunk/com/ssh/async/unstable/test/async.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/buffer.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/list.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/buffer.sig
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/list.sig

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

Modified: mltonlib/trunk/com/ssh/async/unstable/test/async.sml
===================================================================
--- mltonlib/trunk/com/ssh/async/unstable/test/async.sml	2007-03-01 11:50:48 UTC (rev 5371)
+++ mltonlib/trunk/com/ssh/async/unstable/test/async.sml	2007-03-01 12:12:49 UTC (rev 5372)
@@ -13,7 +13,7 @@
    fun eql (ac, ex) = verifyEq (Type.list Type.int) {actual = ac, expect = ex}
    val full = verifyFailsWith (fn Full => true | _ => false)
    fun inc v _ = v += 1
-   fun push l v = List.push (l, v)
+   val push = List.push
 in
    unitTests
       (title "Async.IVar")

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/buffer.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/buffer.sml	2007-03-01 11:50:48 UTC (rev 5371)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/buffer.sml	2007-03-01 12:12:49 UTC (rev 5372)
@@ -29,7 +29,7 @@
                end
    end
    local
-      fun mk sLength sAny sCopy (b as IN {length, data}, s) =
+      fun mk sLength sAny sCopy (b as IN {length, data}) s =
           case sLength s of
              0 => ()
            | n => let
@@ -45,8 +45,8 @@
           mk (Fn.const 1) Fn.id (fn {src, dst, di} => A.update (dst, di, src)) ?
       fun pushArray ? = mk A.length (A.sub /> 0) A.copy ?
       fun pushArraySlice ? = mk AS.length (AS.sub /> 0) AS.copy ?
-      fun pushBuffer (b, s) =
-          pushArraySlice (b, AS.slice (data s, 0, SOME (length s)))
+      fun pushBuffer b s =
+          pushArraySlice b (AS.slice (data s, 0, SOME (length s)))
       fun pushList ? =
           mk List.length List.hd
              (fn {src, dst, di} =>

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/list.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/list.sml	2007-03-01 11:50:48 UTC (rev 5371)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/list.sml	2007-03-01 12:12:49 UTC (rev 5372)
@@ -39,7 +39,7 @@
    end
    fun foldl1 f = fn [] => raise Empty | x::xs => foldl f x xs
    fun foldr1 f = foldl1 f o rev
-   fun push (r, x) = r := x :: !r
+   fun push r x = r := x :: !r
    fun pop r = case !r of x::xs => (r := xs ; SOME x) | [] => NONE
    fun split (l, i) =
        if i < 0 then raise Subscript

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/buffer.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/buffer.sig	2007-03-01 11:50:48 UTC (rev 5371)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/buffer.sig	2007-03-01 12:12:49 UTC (rev 5372)
@@ -17,7 +17,7 @@
    val duplicate : 'a t UnOp.t
    (**
     * Creates a new duplicate of the buffer.  {duplicate b} is equivalent
-    * to {let val b' = new () in pushBuffer (b', b) end}.
+    * to {let val b' = new () in pushBuffer b' b end}.
     *)
 
    (** == Accessors == *)
@@ -56,50 +56,50 @@
 
    (** == Adding Elements to a Buffer == *)
 
-   val push : ('a t * 'a) Effect.t
+   val push : 'a t -> 'a Effect.t
    (**
     * Adds an element to the tail of the buffer.  More precisely, after
     *
     *> val cb = toList b
-    *> val () = push (b, v)
+    *> val () = push b v
     *> val ca = toList b
     *
     * it holds that {cb = init ca} and {last ca = v}.
     *)
 
-   val pushArray : ('a t * 'a Array.t) Effect.t
+   val pushArray : 'a t -> 'a Array.t Effect.t
    (**
-    * Adds the elements of the array to the buffer.  {pushArray (b, a)} is
-    * equivalent to {Array.app (b <\ push) a}.
+    * Adds the elements of the array to the buffer.  {pushArray b a} is
+    * equivalent to {Array.app (push b) a}.
     *)
 
-   val pushArraySlice : ('a t * 'a ArraySlice.t) Effect.t
+   val pushArraySlice : 'a t -> 'a ArraySlice.t Effect.t
    (**
-    * Adds the elements of the slice to the buffer.  {pushArraySlice (b,
-    * s)} is equivalent to {ArraySlice.app (b <\ push) s}.
+    * Adds the elements of the slice to the buffer.  {pushArraySlice b s}
+    * is equivalent to {ArraySlice.app (push b) s}.
     *)
 
-   val pushBuffer : ('a t * 'a t) Effect.t
+   val pushBuffer : 'a t -> 'a t Effect.t
    (**
-    * Adds the elements of the buffer to the buffer.  {pushBuffer (b, b')}
-    * is equivalent to {pushList (b, toList b')}.
+    * Adds the elements of the buffer to the buffer.  {pushBuffer b b'} is
+    * equivalent to {pushList b (toList b')}.
     *)
 
-   val pushList : ('a t * 'a List.t) Effect.t
+   val pushList : 'a t -> 'a List.t Effect.t
    (**
-    * Adds the elements of the list to the buffer.  {pushList (b, l)} is
-    * equivalent to {List.app (b <\ push) l}.
+    * Adds the elements of the list to the buffer.  {pushList b l} is
+    * equivalent to {List.app (push b) l}.
     *)
 
-   val pushVector : ('a t * 'a Vector.t) Effect.t
+   val pushVector : 'a t -> 'a Vector.t Effect.t
    (**
-    * Adds the elements of the vector to the buffer.  {pushVector (b, v)}
-    * is equivalent to {Vector.app (b <\ push) v}.
+    * Adds the elements of the vector to the buffer.  {pushVector b v} is
+    * equivalent to {Vector.app (push b) v}.
     *)
 
-   val pushVectorSlice : ('a t * 'a VectorSlice.t) Effect.t
+   val pushVectorSlice : 'a t -> 'a VectorSlice.t Effect.t
    (**
-    * Adds the elements of the slice to the buffer.  {pushVectorSlice (b,
-    * s)} is equivalent to {VectorSlice.app (b <\ push) s}.
+    * Adds the elements of the slice to the buffer.  {pushVectorSlice b
+    * s} is equivalent to {VectorSlice.app (push b) s}.
     *)
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/list.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/list.sig	2007-03-01 11:50:48 UTC (rev 5371)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/list.sig	2007-03-01 12:12:49 UTC (rev 5372)
@@ -45,7 +45,7 @@
 
    (** == Stack == *)
 
-   val push : ('a t Ref.t * 'a) Effect.t
+   val push : 'a t Ref.t -> 'a Effect.t
    val pop : 'a t Ref.t -> 'a Option.t
 
    (** == HOFs == *)




More information about the MLton-commit mailing list