[MLton-commit] r5533
geoffw at mlton.org
geoffw at mlton.org
Thu Apr 19 10:44:29 PDT 2007
Added Effect.tabulate.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fn/effect.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/effect.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fn/effect.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fn/effect.sml 2007-04-18 11:27:56 UTC (rev 5532)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fn/effect.sml 2007-04-19 17:44:27 UTC (rev 5533)
@@ -10,4 +10,11 @@
val nop = ignore
fun obs ef x = (ef x : unit ; x)
fun past ef x = (ef () : unit ; x)
+ local
+ fun tabulate' m ef =
+ fn 0 => ()
+ | n => (ef m; tabulate' (m + 1) ef (n - 1))
+ in
+ fun tabulate n ef = tabulate' 0 ef n
+ end
end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/effect.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/effect.sig 2007-04-18 11:27:56 UTC (rev 5532)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/effect.sig 2007-04-19 17:44:27 UTC (rev 5533)
@@ -29,4 +29,7 @@
* {past} and {o} you can "attach" side-effects to a function. The
* name {past} comes from the idea that the data flows past the effect.
*)
+
+ val tabulate : Int.t -> (Int.t t) t
+ (** {tabulate n f == (f 0; ... ; f (n - 1))} *)
end
More information about the MLton-commit
mailing list