aboutsummaryrefslogtreecommitdiff
path: root/lib/util.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.ml')
-rw-r--r--lib/util.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 0c3c038dd2..cf5b58b49e 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -223,6 +223,13 @@ let rec list_distinct = function
| h::t -> (not (List.mem h t)) && list_distinct t
| _ -> true
+let rec list_filter2 f = function
+ | [], [] as p -> p
+ | d::dp, l::lp ->
+ let (dp',lp' as p) = list_filter2 f (dp,lp) in
+ if f d l then d::dp', l::lp' else p
+ | _ -> invalid_arg "list_filter2"
+
let list_subset l1 l2 =
let t2 = Hashtbl.create 151 in
List.iter (fun x -> Hashtbl.add t2 x ()) l2;