[MLton-commit] r6515

Vesa Karvonen vesak at mlton.org
Sat Mar 29 04:08:42 PST 2008


Using Monad.filter.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/iter.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/iter.sig

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/iter.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/iter.sml	2008-03-29 12:06:04 UTC (rev 6514)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/iter.sml	2008-03-29 12:08:42 UTC (rev 6515)
@@ -46,8 +46,6 @@
 
    fun iterate f = unfold (fn x => SOME (x, f x))
 
-   fun filter p m = m >>= (fn x => if p x then return x else zero)
-
    fun repeat x = iterate id x
    fun replicate n =
        (subscript (0 <= n)

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/iter.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/iter.sig	2008-03-29 12:06:04 UTC (rev 6514)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/iter.sig	2008-03-29 12:08:42 UTC (rev 6515)
@@ -100,6 +100,8 @@
     *>    (if p x(0) then [<x(0)>] else [<>]) <|> filter p [<x(1), ...>]
     *
     *> fun filter p m = m >>= (fn x => if p x then return x else zero)
+    *
+    * This is the same as {Monad.filter}.
     *)
 
    val >< : 'a t * 'b t -> ('a, 'b) Product.t t




More information about the MLton-commit mailing list