[MLton-commit] r5645

Vesa Karvonen vesak at mlton.org
Tue Jun 19 06:35:54 PDT 2007


Added empty to vectors.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/array.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-mono-array-ext.fun
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-mono-seq-common-ext.fun
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-seq-common-ext.fun
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/vector.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/mono-vector.sig
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/vector.sig

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/array.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/array.sml	2007-06-19 05:27:51 UTC (rev 5644)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/array.sml	2007-06-19 13:35:52 UTC (rev 5645)
@@ -5,12 +5,8 @@
  *)
 
 structure Array : ARRAY = struct
-   local
-      structure Common = MkSeqCommonExt (Array)
-   in
-      open Array Common
-   end
-   fun empty () = tabulate (0, Basic.undefined)
+   structure Common = MkSeqCommonExt (Array)
+   open Common Array
    fun duplicate a = tabulate (length a, fn i => sub (a, i))
    val toVector = vector
    fun fromVector v = tabulate (Vector.length v, fn i => Vector.sub (v, i))

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-mono-array-ext.fun
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-mono-array-ext.fun	2007-06-19 05:27:51 UTC (rev 5644)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-mono-array-ext.fun	2007-06-19 13:35:52 UTC (rev 5645)
@@ -18,7 +18,6 @@
    in
       open MonoArray Common
    end
-   fun empty () = tabulate (0, Basic.undefined)
    local
       fun mk tabulate length sub ? = tabulate (length ?, fn i => sub (?, i))
    in

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-mono-seq-common-ext.fun
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-mono-seq-common-ext.fun	2007-06-19 05:27:51 UTC (rev 5644)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-mono-seq-common-ext.fun	2007-06-19 13:35:52 UTC (rev 5645)
@@ -6,9 +6,11 @@
 
 functor MkMonoSeqCommonExt (type t
                             type elem
+                            val tabulate : Int.t * (Int.t -> elem) -> t
                             val foldr : (elem * 'a -> 'a) -> 'a -> t -> 'a
                             val fromList : elem list -> t
                             val maxLen : int) = struct
+   fun empty () = tabulate (0, Basic.undefined)
    fun unfoldi fis (n, s) = let
       fun lp (i, s, xs) =
           if i = n then (fromList (rev xs), s)

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-seq-common-ext.fun
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-seq-common-ext.fun	2007-06-19 05:27:51 UTC (rev 5644)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-seq-common-ext.fun	2007-06-19 13:35:52 UTC (rev 5645)
@@ -5,9 +5,11 @@
  *)
 
 functor MkSeqCommonExt (type 'a t
+                        val tabulate : Int.t * (Int.t -> 'a) -> 'a t
                         val foldr : ('a * 'b -> 'b) -> 'b -> 'a t -> 'b
                         val fromList : 'a List.t -> 'a t
                         val maxLen : Int.t) = struct
+   fun empty () = tabulate (0, Basic.undefined)
    fun unfoldi fis (n, s) = let
       fun lp (i, s, xs) =
           if i = n then (fromList (rev xs), s)

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/vector.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/vector.sml	2007-06-19 05:27:51 UTC (rev 5644)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/vector.sml	2007-06-19 13:35:52 UTC (rev 5645)
@@ -5,9 +5,6 @@
  *)
 
 structure Vector : VECTOR = struct
-   local
-      structure Common = MkSeqCommonExt (Vector)
-   in
-      open Vector Common
-   end
+   structure Common = MkSeqCommonExt (Vector)
+   open Common Vector
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/mono-vector.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/mono-vector.sig	2007-06-19 05:27:51 UTC (rev 5644)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/mono-vector.sig	2007-06-19 13:35:52 UTC (rev 5645)
@@ -11,6 +11,9 @@
    type t = vector
    (** Convenience alias. *)
 
+   val empty : t Thunk.t
+   (** Returns an empty vector. *)
+
    val unfoldi : (Int.t * 'a -> elem * 'a) -> Int.t * 'a -> t * 'a
    (**
     * {unfoldi f (n, b)} constructs a vector {v} of a length {n}, whose

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/vector.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/vector.sig	2007-06-19 05:27:51 UTC (rev 5644)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/vector.sig	2007-06-19 13:35:52 UTC (rev 5645)
@@ -11,6 +11,9 @@
    type 'a t = 'a vector
    (** Convenience alias. *)
 
+   val empty : 'a t Thunk.t
+   (** Returns an empty vector. *)
+
    val unfoldi : (Int.t * 'b -> 'a * 'b) -> Int.t * 'b -> 'a t * 'b
    (**
     * {unfoldi f (n, b)} constructs a vector {v} of a length {n}, whose




More information about the MLton-commit mailing list