Next: srfi comparators syntax, Previous: srfi comparators applicators, Up: srfi comparators [Index]
These procedures return a comparison procedure, given a less–than predicate, a greater–than predicate, a less–than–or–equal–to predicate, a greater–than–or–equal–to predicate, or the combination of an equality predicate and either a less–than or a greater–than predicate.
They are the same as the corresponding SRFI-67 compare-by
procedures. Note that they do not accept comparand arguments.
Usage examples:
#!vicare (import (vicare) (srfi :114)) (let ((compare (make-comparison< fx<?))) (compare 1 1) ⇒ 0 (compare 1 2) ⇒ -1 (compare 2 1)) ⇒ +1 (let ((compare (make-comparison> fx>?))) (compare 1 1) ⇒ 0 (compare 1 2) ⇒ -1 (compare 2 1)) ⇒ +1 (let ((compare (make-comparison<= fx<=?))) (compare 1 1) ⇒ 0 (compare 1 2) ⇒ -1 (compare 2 1)) ⇒ +1 (let ((compare (make-comparison>= fx>=?))) (compare 1 1) ⇒ 0 (compare 1 2) ⇒ -1 (compare 2 1)) ⇒ +1 (let ((compare (make-comparison=/< fx=? fx<?))) (compare 1 1) ⇒ 0 (compare 1 2) ⇒ -1 (compare 2 1)) ⇒ +1 (let ((compare (make-comparison=/> fx=? fx>?))) (compare 1 1) ⇒ 0 (compare 1 2) ⇒ -1 (compare 2 1)) ⇒ +1