[MLton-commit] r4741
Vesa Karvonen
vesak at mlton.org
Sat Oct 21 06:33:19 PDT 2006
Documentation.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/array.sig
U mltonlib/trunk/com/ssh/extended-basis/unstable/array.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/char.sig
U mltonlib/trunk/com/ssh/extended-basis/unstable/mono-array.sig
U mltonlib/trunk/com/ssh/extended-basis/unstable/mono-vector.sig
U mltonlib/trunk/com/ssh/extended-basis/unstable/readme.txt
U mltonlib/trunk/com/ssh/extended-basis/unstable/string.sig
U mltonlib/trunk/com/ssh/extended-basis/unstable/vector.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/array.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/array.sig 2006-10-21 00:26:40 UTC (rev 4740)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/array.sig 2006-10-21 13:33:16 UTC (rev 4741)
@@ -13,12 +13,40 @@
(** == Conversions == *)
val fromVector : 'a vector -> 'a array
+ (**
+ * Creates a new array from the given vector. Specifically, the
+ * expression {fromVector v} is equivalent to the expression
+ *
+ *> tabulate (Vector.length v, fn i => Vector.sub (v, i))
+ *)
val toList : 'a array -> 'a list
+ (**
+ * Generates a list from the given array. Specifically, the result of
+ * {toList a} is equivalent to {foldr op :: [] a}.
+ *)
+
val toVector : 'a array -> 'a vector
+ (**
+ * Generates a vector from the given array. Specifically, the result
+ * of {toVector a} is equivalent to
+ *
+ *> Vector.tabulate (length a, fn i => sub (a, i))
+ *)
(** == Isomorphisms == *)
val isoList : ('a array, 'a list) iso
+ (**
+ * An isomorphism between arrays and lists. It is always equivalent to
+ * {(toList, fromList)}. Note that the isomorphism does not preserve
+ * identity.
+ *)
+
val isoVector : ('a array, 'a vector) iso
+ (**
+ * An isomorphism between arrays and vectors. It is always equivalent
+ * to {(toVector, fromVector)}. Note that the isomorphism does not
+ * preserve identity.
+ *)
end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/array.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/array.sml 2006-10-21 00:26:40 UTC (rev 4740)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/array.sml 2006-10-21 13:33:16 UTC (rev 4741)
@@ -9,7 +9,7 @@
*)
structure Array : ARRAY = struct
open Array
- fun toList v = foldr op :: [] v
+ fun toList a = foldr op :: [] a
val isoList = (toList, fromList)
val toVector = vector
fun fromVector v = tabulate (Vector.length v, fn i => Vector.sub (v, i))
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/char.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/char.sig 2006-10-21 00:26:40 UTC (rev 4740)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/char.sig 2006-10-21 13:33:16 UTC (rev 4741)
@@ -33,7 +33,7 @@
val isoInt : (char, Int.int) iso
(**
- * The isomorphism between characters and character codes. It always
+ * An isomorphism between characters and character codes. It always
* equals {(ord, chr)}. Note that the projection part of the
* isomorphism, namely {chr}, is likely to be a partial function.
*)
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/mono-array.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/mono-array.sig 2006-10-21 00:26:40 UTC (rev 4740)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/mono-array.sig 2006-10-21 13:33:16 UTC (rev 4741)
@@ -13,15 +13,68 @@
(** == Conversions == *)
val fromPoly : elem Array.array -> array
+ (**
+ * Creates a new monomorphic array from the given polymorphic array.
+ * Specifically, the expression {fromPoly a} is equivalent to the
+ * expression
+ *
+ *> tabulate (Array.length a, fn i => Array.sub (a, i))
+ *)
+
val fromVector : vector -> array
+ (**
+ * Creates a new array from the given vector. Specifically, the
+ * expression {fromVector v} is equivalent to the expression
+ *
+ *> tabulate (Vector.length v, fn i => Vector.sub (v, i))
+ *)
val toList : array -> elem list
+ (**
+ * Generates a list from the given array. Specifically, the result of
+ * {toList a} is equivalent to {foldr op :: [] a}.
+ *)
+
val toPoly : array -> elem Array.array
+ (**
+ * Creates a new polymorphic array from the given monomorphic array.
+ * Specifically, the expression {toPoly a} is equivalent to the
+ * expression
+ *
+ *> Array.tabulate (length a, fn i => Array.sub (a, i))
+ *)
+
val toVector : array -> vector
+ (**
+ * Generates a vector from the given array. Specifically, the result
+ * of {toVector a} is equivalent to
+ *
+ *> MonoVector.tabulate (length a, fn i => sub (a, i))
+ *
+ * where {MonoVector} refers to the home structure of the monomorphic
+ * {vector} type.
+ *)
(** == Isomorphisms == *)
val isoList : (array, elem list) iso
+ (**
+ * An isomorphism between arrays and lists. It is always equivalent to
+ * {(toList, fromList)}. Note that the isomorphism does not preserve
+ * identity.
+ *)
+
val isoPoly : (array, elem Array.array) iso
+ (**
+ * An isomorphism between monomorphic and polymorphic arrays. It is
+ * always equivalent to {(toPoly, fromPoly)}. Note that the
+ * isomorphism does not preserve identity.
+ *)
+
val isoVector : (array, vector) iso
+ (**
+ * An isomorphism between arrays and vectors. It is always equivalent
+ * to {(toVector, fromVector)}. Note that the isomorphism does not
+ * preserve identity.
+ *)
end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/mono-vector.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/mono-vector.sig 2006-10-21 00:26:40 UTC (rev 4740)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/mono-vector.sig 2006-10-21 13:33:16 UTC (rev 4741)
@@ -13,12 +13,38 @@
(** == Conversions == *)
val fromPoly : elem Vector.vector -> vector
+ (**
+ * Generates a monomorphic vector from the given polymorphic vector.
+ * Specifically, the result of {fromPoly v} is equivalent to
+ *
+ *> tabulate (Vector.length v, fn i => Vector.sub (v, i))
+ *)
val toList : vector -> elem list
+ (**
+ * Generates a list from the given vector. Specifically, the result of
+ * {toList v} is equivalent to {foldr op :: [] v}.
+ *)
+
val toPoly : vector -> elem Vector.vector
+ (**
+ * Generates a new polymorphic vector from the given monomorphic
+ * vector. Specifically, the result of {toPoly v} is equivalent to
+ *
+ *> Vector.tabulate (length v, fn i => Vector.sub (v, i))
+ *)
(** == Isomorphisms == *)
val isoList : (vector, elem list) iso
+ (**
+ * An isomorphism between vectors and lists. It is always equivalent
+ * to {(toList, fromList)}.
+ *)
+
val isoPoly : (vector, elem Vector.vector) iso
+ (**
+ * An isomorphism between monomorphic and polymorphic vectors. It is
+ * always equivalent to {(toPoly, fromPoly)}.
+ *)
end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/readme.txt
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/readme.txt 2006-10-21 00:26:40 UTC (rev 4740)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/readme.txt 2006-10-21 13:33:16 UTC (rev 4741)
@@ -36,12 +36,11 @@
easier to use.
On the other hand, it probably doesn't make sense to put everything
- into such extended basis library. As a rule of thumb, things that
- naturally belong (fuzzy, yes) to specific basis library modules and
- what those things depend on should go into such an extended basis lib.
- Everything else, even if looks like stuff that could be in a basis lib,
- but there is no module in *the* basis lib for it, should go into other
- libraries.
+ into this library. As a rule of thumb, things that naturally belong
+ (fuzzy, yes) to specific basis library modules and what those things
+ depend on should go into this library. Everything else, even if looks
+ like stuff that could be in a basis library, but there is no module in
+ *the* basis library for it, should go into other libraries.
References
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/string.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/string.sig 2006-10-21 00:26:40 UTC (rev 4740)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/string.sig 2006-10-21 13:33:16 UTC (rev 4741)
@@ -13,11 +13,24 @@
(** == Embeddings == *)
val embCString : (string, string) emb
+ (**
+ * An embedding of strings into C-style string literals. It is always
+ * equivalent to {(toCString, fromCString)}.
+ *)
+
val embString : (string, string) emb
+ (**
+ * An embedding of strings into SML-style string literals. It is
+ * always equivalent to {(toString, fromString)}.
+ *)
(** == Isomorphisms == *)
val isoList : (string, char list) iso
+ (**
+ * An isomorphism between strings and lists. It is always equivalent
+ * to {(toList, fromList)}.
+ *)
(** == {MONO_VECTOR} == *)
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/vector.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/vector.sig 2006-10-21 00:26:40 UTC (rev 4740)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/vector.sig 2006-10-21 13:33:16 UTC (rev 4741)
@@ -13,8 +13,16 @@
(** == Conversions == *)
val toList : 'a vector -> 'a list
+ (**
+ * Generates a list from the given vector. Specifically, the result of
+ * {toList v} is equivalent to {foldr op :: [] v}.
+ *)
(** == Isomorphisms == *)
val isoList : ('a vector, 'a list) iso
+ (**
+ * An isomorphism between vectors and lists. It is always equivalent
+ * to {(toList, fromList)}.
+ *)
end
More information about the MLton-commit
mailing list