Commit e0b14665 authored by POTTIER Francois's avatar POTTIER Francois

Added [MenhirLib.General.weed], the composition of [sort] and [uniq].

parent 29da64b1
......@@ -40,6 +40,10 @@ let uniq cmp xs =
| x :: xs ->
x :: uniq1 cmp x xs
let weed cmp xs =
uniq cmp (List.sort cmp xs)
(* TEMPORARY dead code, if we remove [compare_words] *)
let rec compare cmp xs ys =
match xs, ys with
| [], [] ->
......
......@@ -22,6 +22,10 @@ val drop: int -> 'a list -> 'a list
val uniq: ('a -> 'a -> int) -> 'a list -> 'a list
(* [weed cmp xs] returns the list [xs] deprived of any duplicate elements. *)
val weed: ('a -> 'a -> int) -> 'a list -> 'a list
(* If [cmp] is an ordering on elements, then [compare cmp] is the
lexicographic ordering on lists. *)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment