[MLton-commit] r4824
Vesa Karvonen
vesak at mlton.org
Wed Nov 15 01:19:36 PST 2006
Added dup to array modules.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/array.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-mono-array-ext.fun
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/array.sig
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/mono-array.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/array.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/array.sml 2006-11-14 17:39:39 UTC (rev 4823)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/array.sml 2006-11-15 09:19:29 UTC (rev 4824)
@@ -10,6 +10,7 @@
structure Array : ARRAY = struct
open Array
type 'a t = 'a array
+ fun dup a = tabulate (length a, fn i => sub (a, i))
fun toList a = foldr op :: [] a
val isoList = (toList, fromList)
val toVector = vector
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-mono-array-ext.fun
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-mono-array-ext.fun 2006-11-14 17:39:39 UTC (rev 4823)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-mono-array-ext.fun 2006-11-15 09:19:29 UTC (rev 4824)
@@ -13,6 +13,7 @@
where type vector = MonoVector.vector) = struct
open MonoArray
type t = array
+ fun dup a = tabulate (length a, fn i => sub (a, i))
fun toList a = foldr op :: [] a
val isoList = (toList, fromList)
val toVector = vector
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/array.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/array.sig 2006-11-14 17:39:39 UTC (rev 4823)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/array.sig 2006-11-15 09:19:29 UTC (rev 4824)
@@ -15,6 +15,12 @@
* Convenience alias.
*)
+ val dup : 'a t -> 'a t
+ (**
+ * Makes a fresh duplicate of the given array. {dup a} is equivalent
+ * to {tabulate (length a, fn i => sub (a, i))}.
+ *)
+
(** == Conversions == *)
val fromVector : 'a vector -> 'a array
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/mono-array.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/mono-array.sig 2006-11-14 17:39:39 UTC (rev 4823)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/mono-array.sig 2006-11-15 09:19:29 UTC (rev 4824)
@@ -15,6 +15,12 @@
* Convenience alias.
*)
+ val dup : t -> t
+ (**
+ * Makes a fresh duplicate of the given array. {dup a} is equivalent
+ * to {tabulate (length a, fn i => sub (a, i))}.
+ *)
+
(** == Conversions == *)
val fromPoly : elem Array.array -> array
More information about the MLton-commit
mailing list