[MLton-commit] r5535

Vesa Karvonen vesak at mlton.org
Sat Apr 21 12:17:45 PDT 2007


Minor simplifications.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/list.sml

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/list.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/list.sml	2007-04-21 16:33:32 UTC (rev 5534)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/list.sml	2007-04-21 19:17:45 UTC (rev 5535)
@@ -96,25 +96,19 @@
       fun takeWhile ? = rev o #1 o mk op :: [] ?
       fun dropWhile ? = #2 o mk ignore () ?
    end
-   
-   fun uniqueByEq eq xs = 
-       case xs
-         of [] => true
-          | x::xs' => 
-            (not o (exists (Fn.curry eq x))) xs' andalso
-            uniqueByEq eq xs' 
-
-   local
-     fun divideByEqTail eq xs accum = 
-         case xs
-           of [] => rev accum 
-            | x::xs' => let
-                val (xclass, remainder) = partition (Fn.curry eq x) xs'
-              in
-                divideByEqTail eq remainder ((x::xclass)::accum)
-              end
+   fun uniqueByEq eq =
+    fn [] => true
+     | x::xs => not (exists (Fn.curry eq x) xs) andalso uniqueByEq eq xs
+   fun divideByEq eq = let
+      fun lp accum =
+       fn [] => rev accum
+        | x::xs => let
+             val (xclass, remainder) = partition (Fn.curry eq x) xs
+          in
+             lp ((x::xclass)::accum) remainder
+          end
    in
-     fun divideByEq eq xs = divideByEqTail eq xs []
+      lp []
    end
    fun nubByEq eq =
        rev o foldl (fn (x, ys) =>




More information about the MLton-commit mailing list