[MLton-commit] r5334

Vesa Karvonen vesak at mlton.org
Mon Feb 26 08:45:13 PST 2007


Added Fn.fix and Fn.recur and exposed recur at the top-level.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fn.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/top-level.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/fn.sig

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fn.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fn.sml	2007-02-26 12:25:23 UTC (rev 5333)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fn.sml	2007-02-26 16:45:11 UTC (rev 5334)
@@ -6,16 +6,18 @@
 
 structure Fn :> FN = struct
    open Fn
-   fun map (f, g) h = g o h o f
    fun const x _ = x
    fun curry f x y = f (x, y)
    fun failing e _ = raise e
+   fun fix f x = f (fix f) x
    fun flip f x y = f y x
    fun id x = x
+   fun map (f, g) h = g o h o f
+   fun pass x f = f x
+   fun recur x = flip fix x
    fun uncurry f (x, y) = f x y
+   fun undefined _ = raise Fail "undefined"
    val op o = op o
-   fun pass x f = f x
-   fun undefined _ = raise Fail "undefined"
    fun op <\ (x, f) y = f (x, y)
    fun op \> (f, y) = f y
    fun op /> (f, y) x = f (x, y)

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/top-level.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/top-level.sml	2007-02-26 12:25:23 UTC (rev 5333)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/top-level.sml	2007-02-26 16:45:11 UTC (rev 5334)
@@ -26,6 +26,7 @@
 val flip = Fn.flip
 val id = Fn.id
 val pass = Fn.pass
+val recur = Fn.recur
 val uncurry = Fn.uncurry
 val undefined = Fn.undefined
 val op /> = Fn./>

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/fn.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/fn.sig	2007-02-26 12:25:23 UTC (rev 5333)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/fn.sig	2007-02-26 16:45:11 UTC (rev 5334)
@@ -9,6 +9,9 @@
    type ('a, 'b) t = 'a -> 'b
    (** The type of functions. *)
 
+   val fix : ('a -> 'b) Fix.t
+   (** Fixpoint of given functional. *)
+
    val map : ('c -> 'a) * ('b -> 'd) -> ('a -> 'b) -> 'c -> 'd
    (** {map (f, g) h = g o h o f}. *)
 
@@ -39,6 +42,9 @@
    val pass : 'a -> ('a -> 'b) -> 'b
    (** Pass to continuation ({pass x f = f x}). *)
 
+   val recur : 'a -> ('a -> 'b) UnOp.t -> 'b
+   (** {recur} is same as {flip fix}. *)
+
    val undefined : 'a -> 'b
    (**
     * An undefined function.  This is equivalent to {failing (Fail




More information about the MLton-commit mailing list