|(require rebellion/base/comparator)||package: rebellion|
A predicate for comparators.
comparator : comparator? left : any/c right : any/c
Returns whether left is less than, greater than, or equivalent to right.
comparator : comparator? f : (-> any/c any/c) name : (or/c interned-symbol? #f) = #f
Wraps comparator as a comparator that first calls f on both of its inputs before comparing them.
> (define-record-type circle (color radius)) > (define circle<=> (comparator-map real<=> circle-radius))
> (compare circle<=> (circle #:color 'green #:radius 5) (circle #:color 'blue #:radius 8))
function : (-> any/c any/c comparison?) name : (or/c interned-symbol? #f) = #f
Constructs a comparator named name that compares values by calling function. Most users should use comparator-map to wrap an existing comparator instead of constructing one directly.
Reverses comparator, returning a comparator that considers one value greater than another when comparator would consider it lesser and vice-versa.
A comparator that compares real numbers.
A comparator that lexicographically compares immutable strings. Mutable strings are disallowed, to prevent clients from concurrently mutating a string while it’s being compared.
A predicate for comparison constants.
A comparison constant indicating that the left value of a comparison is smaller than the right value.
A comparison constant indicating that the left value of a comparison is greater than the right value.