Next: , Previous: , Up: srfi ilists procs   [Index]


2.40.6.14 Comparators

The following syntactic bindings are exported by the library (srfi :116 comparators).

Constant: ipair-comparator

The ipair-comparator object is a SRFI-114 comparator suitable for comparing ipairs. Note that it is not a procedure. It compares pairs using default-comparator on their cars. If the cars are not equal, that value is returned. If they are equal, default-comparator is used on their cdrs and that value is returned.

Constant: ilist-comparator

The ilist-comparator object is a SRFI-114 comparator suitable for comparing ilists. Note that it is not a procedure. It compares ilists lexicographically, as follows:

Function: comparator make-pair-comparator car-comparator cdr-comparator

Return a comparator that compares pairs first on their cars using car-comparator. If the cars are equal: it compares the cdrs using cdr-comparator. The hash function makes use of both the car and the cdr.

Function: comparator make-ilist-comparator element-comparator

Return a comparator suitable for comparing ilists using element-comparator to compare the elements.

Function: comparator make-improper-ilist-comparator comparator

Return a comparator that compares arbitrary objects as follows: the empty list precedes all ipairs, which precede all other objects. Ipairs are compared as if with:

(make-ipair-comparator comparator comparator)

All other objects are compared using comparator.

Function: comparator make-icar-comparator comparator

Return a comparator that compares ipairs on their icars alone using comparator.

Function: comparator make-icdr-comparator comparator

Return a comparator that compares ipairs on their icdrs alone using comparator.


Next: , Previous: , Up: srfi ilists procs   [Index]