CCOrdOrder combinators
val poly : 'a tPolymorphic "magic" comparison. Use with care, as it will fail on some types.
val compare : 'a tPolymorphic "magic" comparison.
Opposite order. For example, opp cmp a b < 0 iff cmp b a > 0. This can be used to sort values in the opposite order, among other things.
val int : int tval string : string tval bool : bool tval float : float tval (<?>) : int -> ('a t * 'a * 'a) -> intc1 <?> (ord, x, y) returns the same as c1 if c1 is not 0; otherwise it uses ord to compare the two values x and y, of type 'a.
Example:
CCInt.compare 1 3
<?> (String.compare, "a", "b")
<?> (CCBool.compare, true, false)Same example, using only CCOrd::
CCOrd.(int 1 3
<?> (string, "a", "b")
<?> (bool, true, false))map f ord is the comparison function that, given objects x and y, projects x and y using f (e.g. using a record field) and then compares those projections with ord. Example: map fst CCInt.compare compares values of type (int * 'a) by their first component.
module Infix : sig ... end