Project

General

Profile

Revision 45c13277 src/utils.ml

View differences:

src/utils.ml
43 43
  | None   -> None
44 44
  | Some e -> Some (f e)
45 45

  
46
let add_cons x l =
47
 if List.mem x l then l else x::l
48

  
46 49
let rec remove_duplicates l =
47 50
 match l with
48 51
 | [] -> []
49
 | t::q -> if List.mem t q then remove_duplicates q else t :: remove_duplicates q
52
 | t::q -> add_cons t (remove_duplicates q)
50 53

  
51 54
let position pred l =
52 55
  let rec pos p l =

Also available in: Unified diff