Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
let uniq lst =
|
||||
let unique_set = Hashtbl.create (List.length lst) in
|
||||
List.iter (fun x -> Hashtbl.replace unique_set x ()) lst;
|
||||
Hashtbl.fold (fun x () xs -> x :: xs) unique_set []
|
||||
|
||||
let _ =
|
||||
uniq [1;2;3;2;3;4]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
let uniq lst =
|
||||
let seen = Hashtbl.create (List.length lst) in
|
||||
List.filter (fun x -> let tmp = not (Hashtbl.mem seen x) in
|
||||
Hashtbl.replace seen x ();
|
||||
tmp) lst
|
||||
|
||||
let _ =
|
||||
uniq [1;2;3;2;3;4]
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
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
|
||||
|
|
@ -0,0 +1 @@
|
|||
List.sort_uniq compare [1;2;3;2;3;4]
|
||||
Loading…
Add table
Add a link
Reference in a new issue