Module CCOrd
Comparisons
val compare : 'a tPolymorphic "magic" comparison.
Lexicographic Combination
val (<?>) : int -> ('a t * 'a * 'a) -> intc1 <?> (ord, x, y)returns the same asc1ifc1is not0; otherwise it usesordto compare the two valuesxandy, 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))
val option : 'a t -> 'a option tComparison of optional values.
Noneis smaller than anySome _.- since
- 0.15
val pair : 'a t -> 'b t -> ('a * 'b) tval triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) tval list : 'a t -> 'a list tLexicographic combination on lists.
val array : 'a t -> 'a array tval map : ('a -> 'b) -> 'b t -> 'a tmap f ordis the comparison function that, given objectsxandy, projectsxandyusingf(e.g. using a record field) and then compares those projections withord. Example:map fst CCInt.comparecompares values of type(int * 'a)by their first component.
module Infix : sig ... end