Browse Source

add `remove_duplicates`

Simon Krajewski 9 years ago
parent
commit
7c9f349f5c
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/syntax/ast.ml

+ 4 - 0
src/syntax/ast.ml

@@ -920,3 +920,7 @@ let full_dot_path mpath tpath =
 
 let safe_for_all2 f a b =
 	try List.for_all2 f a b with _ -> false
+
+let rec remove_duplicates f l = match l with
+	| [] -> []
+	| x :: l -> x :: (remove_duplicates f (List.filter (fun x' -> f x x') l))