From 2492ee48a6579baf4da4a46c0833dd9c9a7ee2d5 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 14 Jun 2014 02:16:14 +0200 Subject: [PATCH] small change in CCOrd --- core/CCOrd.ml | 7 +++++++ core/CCOrd.mli | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/core/CCOrd.ml b/core/CCOrd.ml index fe393055..8474e12e 100644 --- a/core/CCOrd.ml +++ b/core/CCOrd.ml @@ -31,6 +31,13 @@ type 'a t = 'a -> 'a -> int let compare = Pervasives.compare +let opp f x y = - (f x y) + +let equiv i j = + if i<0 then j<0 + else if i>0 then j>0 + else j=0 + let int_ (x:int) y = Pervasives.compare x y let string_ (x:string) y = Pervasives.compare x y let bool_ (x:bool) y = Pervasives.compare x y diff --git a/core/CCOrd.mli b/core/CCOrd.mli index 80a38d6d..90e929d8 100644 --- a/core/CCOrd.mli +++ b/core/CCOrd.mli @@ -32,6 +32,12 @@ type 'a t = 'a -> 'a -> int val compare : 'a t (** Polymorphic "magic" comparison *) +val opp : 'a t -> 'a t +(** Opposite order *) + +val equiv : int -> int -> bool +(** Returns [true] iff the two comparison results are the same *) + val int_ : int t val string_ : string t val bool_ : bool t