aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util.ml10
-rw-r--r--lib/util.mli1
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 66485d5a36..ee373120e2 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -123,8 +123,6 @@ module Stringmap = Map.Make(struct type t = string let compare = compare end)
(* Lists *)
-let list_add_set x l = if List.mem x l then l else x::l
-
let list_intersect l1 l2 =
List.filter (fun x -> List.mem x l2) l1
@@ -267,6 +265,14 @@ let rec list_remove_first a = function
| b::l -> b::list_remove_first a l
| [] -> raise Not_found
+let list_add_set x l = if List.mem x l then l else x::l
+
+let list_eq_set l1 l2 =
+ let rec aux l1 = function
+ | [] -> l1 = []
+ | a::l2 -> aux (list_remove_first a l1) l2 in
+ try aux l1 l2 with Not_found -> false
+
let list_for_all2eq f l1 l2 = try List.for_all2 f l1 l2 with Failure _ -> false
let list_map_i f =
diff --git a/lib/util.mli b/lib/util.mli
index f38f36740c..afa11d31dc 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -78,6 +78,7 @@ module Stringmap : Map.S with type key = string
(*s Lists. *)
val list_add_set : 'a -> 'a list -> 'a list
+val list_eq_set : 'a list -> 'a list -> bool
val list_intersect : 'a list -> 'a list -> 'a list
val list_union : 'a list -> 'a list -> 'a list
val list_unionq : 'a list -> 'a list -> 'a list