chickadee » srfi-128 » make-list-comparator

make-list-comparator element-comparator type-test empty? head tailprocedure

This procedure returns comparators whose functions behave as follows:

  • The type test returns #t if its argument satisfies type-test and the elements satisfy the type test predicate of element-comparator.
  • The total order defined by the equality and ordering functions is as follows (known as lexicographic order):
    • The empty sequence, as determined by calling empty?, compares equal to itself.
    • The empty sequence compares less than any non-empty sequence.
    • Two non-empty sequences are compared by calling the head procedure on each. If the heads are not equal when compared using element-comparator, the result is the result of that comparison. Otherwise, the results of calling the tail procedure are compared recursively.
  • The hash function computes the hash values of the elements using the hash function of element-comparator and then hashes them together in an implementation-defined way.