RosettaCodeData/Task/Remove-duplicate-elements/OCaml/remove-duplicate-elements-3.ocaml

7 lines
165 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
let uniq l =
let rec tail_uniq a l =
match l with
| [] -> a
| hd::tl -> tail_uniq (hd::a) (List.filter (fun x -> x != hd) tl) in
tail_uniq [] l