[procedure] vector-compare [compare] x y [size ref]

[procedure] vector-compare-as-list [compare] x y [size ref]

[procedure] list-compare [compare] x y [empty? head tail]

[procedure] list-compare-as-vector [compare] x y [empty? head tail]

SRFI-67: Compare two sequences x and y, using compare for comparing elements. The result is an exact integer in {-1, 0, 1}. If compare is not supplied, default-compare is used.

The procedure named access-compare-as-order accesses the objects like access and compares them with respect to the order given by order. The names type-compare are abbreviations for type-compare-as-type.

Independent of the way the elements are accessed, the natural ordering of vectors and lists differs: Sequences are compared as vectors if shorter sequences are smaller than longer sequences, and sequences of the same size are compared lexicographically. Sequences are compared as lists if the empty sequence is smallest, and two non-empty sequences are compared by their first elements, and only if the first elements are equal the residual sequences are compared, recursively.

An object x can be accessed like a vector if there are procedures size and ref such that (size x) is a non-negative integer n indicating the number of elements, and (ref x i) is the i-th element of x for 0 <= i < n. The default vector access procedures are vector-length and vector-ref.

An object x can be accessed like a (proper) list if there are procedures empty?, head, and tail such that (empty? x) is a boolean indicating that there are no elements in x, (head x) is the first element of x, and (tail x) is an object representing the residual elements of x. The default list access procedures are null?, car, and cdr.