removed obsolete partition (cf. List.partition);
authorwenzelm
Sat, 20 May 2006 23:37:02 +0200
changeset 19691 dd9ccb370f52
parent 19690 8c03cadf9886
child 19692 bad13b32c0f3
removed obsolete partition (cf. List.partition); tuned;
src/Pure/library.ML
--- a/src/Pure/library.ML	Sat May 20 23:37:00 2006 +0200
+++ b/src/Pure/library.ML	Sat May 20 23:37:02 2006 +0200
@@ -288,7 +288,6 @@
   val drop: int * 'a list -> 'a list
   val last_elem: 'a list -> 'a
   val seq: ('a -> unit) -> 'a list -> unit
-  val partition: ('a -> bool) -> 'a list -> 'a list * 'a list
 end;
 
 structure Library: LIBRARY =
@@ -1228,18 +1227,6 @@
   let val (ys, recomb) = decomp x
   in recomb (map (divide_and_conquer decomp) ys) end;
 
-(*Partition list into elements that satisfy predicate and those that don't.
-  Preserves order of elements in both lists.*)
-val partition = List.partition;
-
-fun partition_eq (eq:'a * 'a -> bool) =
-  let
-    fun part [] = []
-      | part (x :: ys) =
-          let val (xs, xs') = partition (fn y => eq (x, y)) ys
-          in (x::xs)::(part xs') end
-  in part end;
-
 
 (*Partition a list into buckets  [ bi, b(i+1), ..., bj ]
    putting x in bk if p(k)(x) holds.  Preserve order of elements if possible.*)
@@ -1249,10 +1236,19 @@
               (case xs of [] => []
                          | _ => raise Fail "partition_list")
             else
-            let val (ns, rest) = partition (p k) xs;
+            let val (ns, rest) = List.partition (p k) xs;
             in  ns :: part(k+1)rest  end
   in  part i end;
 
+fun partition_eq (eq:'a * 'a -> bool) =
+  let
+    fun part [] = []
+      | part (x :: ys) =
+          let val (xs, xs') = List.partition (fn y => eq (x, y)) ys
+          in (x::xs)::(part xs') end
+  in part end;
+
+
 
 (* generating identifiers *)