[MLton-commit] r5918

Vesa Karvonen vesak at mlton.org
Tue Aug 21 12:25:34 PDT 2007


Using Buffer.findSome.

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

U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/ord.sml
U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/seq.sml

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

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/ord.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/ord.sml	2007-08-21 19:22:30 UTC (rev 5917)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/ord.sml	2007-08-21 19:25:33 UTC (rev 5918)
@@ -83,13 +83,9 @@
 
       val exns : (e * Exn.t Sq.t -> (e * Order.t) Option.t) Buffer.t = Buffer.new ()
       fun exn (e, lr) =
-          recur 0 (fn lp =>
-             fn i =>
-                if i = Buffer.length exns
-                then GenericsUtil.failExnSq lr
-                else case Buffer.sub (exns, i) (e, lr)
-                      of SOME r => r
-                       | NONE   => lp (i+1))
+          case Buffer.findSome (pass (e, lr)) exns
+           of NONE   => GenericsUtil.failExnSq lr
+            | SOME r => r
       fun regExn aO (_, e2a) =
           (Buffer.push exns)
              (fn (e, (l, r)) =>

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/seq.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/seq.sml	2007-08-21 19:22:30 UTC (rev 5917)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/seq.sml	2007-08-21 19:25:33 UTC (rev 5918)
@@ -90,13 +90,9 @@
 
       val exns : (e * Exn.t Sq.t -> (e * Bool.t) Option.t) Buffer.t = Buffer.new ()
       fun exn (e, lr) =
-          recur 0 (fn lp =>
-             fn i =>
-                if i = Buffer.length exns
-                then GenericsUtil.failExnSq lr
-                else case Buffer.sub (exns, i) (e, lr)
-                      of SOME r => r
-                       | NONE   => lp (i+1))
+          case Buffer.findSome (pass (e, lr)) exns
+           of NONE   => GenericsUtil.failExnSq lr
+            | SOME r => r
       fun regExn aE (_, e2a) =
           (Buffer.push exns)
              (fn (e, (l, r)) =>




More information about the MLton-commit mailing list