include Base.Comparable.S with type t := T.t and type comparator_witness := T.comparator_witness
val ascending : T.t -> T.t -> int
ascending
is identical tocompare
.descending x y = ascending y x
. These are intended to be mnemonic when used likeList.sort ~compare:ascending
andList.sort ~cmp:descending
, since they cause the list to be sorted in ascending or descending order, respectively.
val descending : T.t -> T.t -> int
val between : T.t -> low:T.t -> high:T.t -> bool
between t ~low ~high
meanslow <= t <= high
val clamp_exn : T.t -> min:T.t -> max:T.t -> T.t
clamp_exn t ~min ~max
returnst'
, the closest value tot
such thatbetween t' ~low:min ~high:max
is true.Raises if
not (min <= max)
.
val clamp : T.t -> min:T.t -> max:T.t -> T.t Base.Or_error.t
include Base.Comparator.S with type comparator_witness := T.comparator_witness and type t := T.t
val comparator : (T.t, T.comparator_witness) Base.Comparator.comparator
val validate_lbound : min:T.t Base.Maybe_bound.t -> T.t Base.Validate.check
val validate_ubound : max:T.t Base.Maybe_bound.t -> T.t Base.Validate.check
val validate_bound : min:T.t Base.Maybe_bound.t -> max:T.t Base.Maybe_bound.t -> T.t Base.Validate.check
module Replace_polymorphic_compare : sig ... end
module Map : Map.S with type Key.t = T.t with type Key.comparator_witness = T.comparator_witness
module Set : Set.S with type Elt.t = T.t with type Elt.comparator_witness = T.comparator_witness