aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorherbelin2007-04-13 13:20:51 +0000
committerherbelin2007-04-13 13:20:51 +0000
commitc7b4398341e1fec6c485f39cde8d42fa3ff6abff (patch)
tree287f86abf547207168f55c4e4fe37d06f0a58b3d /lib
parentba8f9564e492cd8d25a193cfc5883ed06faaea02 (diff)
Correction bug #1477 sur ordre des variables partagées par les or-patterns.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@9764 85f007b7-540e-0410-9357-904b9bb8a0f7
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