[MLton-commit] r4858

Vesa Karvonen vesak at mlton.org
Wed Nov 22 08:26:11 PST 2006


Minor refactoring.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-mono-array-ext.fun

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

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-22 16:04:16 UTC (rev 4857)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-mono-array-ext.fun	2006-11-22 16:26:08 UTC (rev 4858)
@@ -17,12 +17,15 @@
    in
       open MonoArray Common
    end
-   fun duplicate a = tabulate (length a, fn i => sub (a, i))
+   local
+      fun mk tabulate length sub ? = tabulate (length ?, fn i => sub (?, i))
+   in
+      fun duplicate ? = mk tabulate length sub ?
+      fun fromVector ? = mk tabulate MonoVector.length MonoVector.sub ?
+      fun toPoly ? = mk Array.tabulate length sub ?
+      fun fromPoly ? = mk tabulate Array.length Array.sub ?
+   end
    val toVector = vector
-   fun fromVector v =
-       tabulate (MonoVector.length v, fn i => MonoVector.sub (v, i))
    val isoVector = (toVector, fromVector)
-   fun toPoly a = Array.tabulate (length a, fn i => sub (a, i))
-   fun fromPoly a = tabulate (Array.length a, fn i => Array.sub (a, i))
    val isoPoly = (toPoly, fromPoly)
 end




More information about the MLton-commit mailing list