- make-vector-comparator element-comparator type-test length refprocedure
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 equality predicate returns #t if both of the following tests are satisfied in order: the lengths of the vectors are the same in the sense of =, and the elements of the vectors are the same in the sense of the equality predicate of element-comparator.
- The ordering predicate returns #t if the results of applying length to the first vector is less than the result of applying length to the second vector. If the lengths are equal, then the elements are examined pairwise using the ordering predicate of element-comparator. If any pair of elements returns #t, then that is the result of the list comparator's ordering predicate; otherwise the result is #f
- 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.
Here is an example, which returns a comparator for byte vectors:
(make-vector-comparator (make-comparator exact-integer? = < number-hash) bytevector? bytevector-length bytevector-u8-ref)