aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorletouzey2013-10-23 22:17:33 +0000
committerletouzey2013-10-23 22:17:33 +0000
commitbb5e6d7c39211349d460db0b61b2caf3d099d5b6 (patch)
treee14b120edc5fedcb1a0a114218d1cdaa0f887ed4 /kernel
parent4e20ed9e5c1608226f0d736df10bb82fc402e7a2 (diff)
cList: a few alternative to hashtbl-based uniquize, distinct, subset
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16924 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'kernel')
-rw-r--r--kernel/names.ml12
-rw-r--r--kernel/names.mli3
2 files changed, 12 insertions, 3 deletions
diff --git a/kernel/names.ml b/kernel/names.ml
index 2a04ff3c55..00b8df4862 100644
--- a/kernel/names.ml
+++ b/kernel/names.ml
@@ -71,10 +71,16 @@ module Name =
struct
type t = Name of Id.t | Anonymous
+ let compare n1 n2 = match n1, n2 with
+ | Anonymous, Anonymous -> 0
+ | Name id1, Name id2 -> Id.compare id1 id2
+ | Anonymous, Name _ -> -1
+ | Name _, Anonymous -> 1
+
let equal n1 n2 = match n1, n2 with
- | Anonymous, Anonymous -> true
- | Name id1, Name id2 -> String.equal id1 id2
- | _ -> false
+ | Anonymous, Anonymous -> true
+ | Name id1, Name id2 -> String.equal id1 id2
+ | _ -> false
module Self_Hashcons =
struct
diff --git a/kernel/names.mli b/kernel/names.mli
index 82df075626..6f4ac9a530 100644
--- a/kernel/names.mli
+++ b/kernel/names.mli
@@ -53,6 +53,9 @@ sig
type t = Name of Id.t | Anonymous
(** A name is either undefined, either an identifier. *)
+ val compare : t -> t -> int
+ (** Comparison over names. *)
+
val equal : t -> t -> bool
(** Equality over names. *)