mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
use standard List.sort_uniq
This commit is contained in:
parent
09d5b146f2
commit
7a22286ca1
1 changed files with 1 additions and 7 deletions
|
|
@ -580,13 +580,7 @@ let sorted_merge ~cmp l1 l2 =
|
||||||
List.length (sorted_merge ~cmp:CCInt.compare l1 l2) = List.length l1 + List.length l2)
|
List.length (sorted_merge ~cmp:CCInt.compare l1 l2) = List.length l1 + List.length l2)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let sort_uniq (type elt) ~cmp l =
|
let sort_uniq (type elt) ~cmp l = List.sort_uniq cmp l
|
||||||
let module S = Set.Make(struct
|
|
||||||
type t = elt
|
|
||||||
let compare = cmp
|
|
||||||
end) in
|
|
||||||
let set = fold_right S.add l S.empty in
|
|
||||||
S.elements set
|
|
||||||
|
|
||||||
(*$T
|
(*$T
|
||||||
sort_uniq ~cmp:CCInt.compare [1;2;5;3;6;1;4;2;3] = [1;2;3;4;5;6]
|
sort_uniq ~cmp:CCInt.compare [1;2;5;3;6;1;4;2;3] = [1;2;3;4;5;6]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue