aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/util.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.ml')
-rw-r--r--lib/util.ml13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 30f1cbeb6..bb5023886 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -91,10 +91,6 @@ let list_assign l n e =
in
assrec [] (l,n)
-let rec list_distinct = function
- | h::t -> (not (List.mem h t)) && list_distinct t
- | [] -> true
-
let list_map_i f =
let rec map_i_rec i = function
| [] -> []
@@ -154,6 +150,15 @@ let rec list_distinct = function
| h::t -> (not (List.mem h t)) && list_distinct t
| _ -> true
+let list_subset l1 l2 =
+ let t2 = Hashtbl.create 151 in
+ List.iter (fun x -> Hashtbl.add t2 x ()) l2;
+ let rec look = function
+ | [] -> true
+ | x::ll -> try Hashtbl.find t2 x; look ll with Not_found -> false
+ in
+ look l1
+
(* Arrays *)
let array_exists f v =