bag-comparator
⟹
comparator?

bag-comparator
⟹
comparator?

(
bag-element-comparator
[
bag?
bag
]
)
⟹
comparator?

(
bag-element-comparator
[
bag?
bag
]
)
⟹
comparator?

c128vector-comparator
⟹
comparator?

c128vector-comparator
⟹
comparator?

c64vector-comparator
⟹
comparator?

c64vector-comparator
⟹
comparator?

f32vector-comparator
⟹
comparator?

f32vector-comparator
⟹
comparator?

f64vector-comparator
⟹
comparator?

f64vector-comparator
⟹
comparator?

(
hashmap-key-comparator
[
hashmap?
hashmap
]
)
⟹
comparator?

(
hashmap-key-comparator
[
hashmap?
hashmap
]
)
⟹
comparator?

ilist-comparator
⟹
comparator?

ilist-comparator
⟹
comparator?

ipair-comparator
⟹
comparator?

ipair-comparator
⟹
comparator?

(
make-comparator
[
procedure?
type-test
]
[
procedure?
equality
]
[
#f
/
procedure?
ordering
]
[
#f
/
procedure?
hash
]
)
⟹
comparator?

type-test
⟹
(
λ
obj
)
⟹
boolean?

equality
⟹
(
λ
obj1
obj2
)
⟹
boolean?

ordering
⟹
(
λ
obj1
obj2
)
⟹
boolean?

hash
⟹
(
λ
obj
)
⟹
integer?

Returns a comparator which bundles the type-test, equality, ordering, and hash procedures provided. However, if ordering or hash is #f, a procedure is provided that signals an error on application. The predicates comparator-ordered? and/or comparator-hashable?, respectively, will return #f in these cases.

(
make-comparator
[
procedure?
type-test
]
[
procedure?
equality
]
[
#f
/
procedure?
ordering
]
[
#f
/
procedure?
hash
]
)
⟹
comparator?

type-test
⟹
(
λ
obj
)
⟹
boolean?

equality
⟹
(
λ
obj1
obj2
)
⟹
boolean?

ordering
⟹
(
λ
obj1
obj2
)
⟹
boolean?

hash
⟹
(
λ
obj
)
⟹
integer?

Returns a comparator which bundles the type-test, equality, ordering, and hash procedures provided. However, if ordering or hash is #f, a procedure is provided that signals an error on application. The predicates comparator-ordered? and/or comparator-hashable?, respectively, will return #f in these cases.

(
make-default-comparator
)
⟹
comparator?

Returns a comparator known as a default comparator that accepts Scheme values and orders them in some implementation-defined way, subject to the following conditions:
1 Given disjoint types a and b, one of three conditions must hold:
1.1 All objects of type a compare less than all objects of type b.
1.2 All objects of type a compare greater than all objects of type b.
1.3 All objects of both type a and type b compare equal to each other. This is not permitted for any of the Scheme types mentioned below.
2 The empty list must be ordered before all pairs.
3 When comparing booleans, it must use the total order #f < #t.
4 When comparing characters, it must use char=? and char<?. Note: In R5RS, this is an implementation-dependent order that is typically the same as Unicode codepoint order; in R6RS and R7RS, it is Unicode codepoint order.
5 When comparing pairs, it must behave the same as a comparator returned by make-pair-comparator with default comparators as arguments.
6 When comparing symbols, it must use an implementation-dependent total order. One possibility is to use the order obtained by applying symbol->string to the symbols and comparing them using the total order implied by string<?.
7 When comparing bytevectors, it must behave the same as a comparator created by the expression (make-vector-comparator (make-comparator bytevector? = < number-hash) bytevector? bytevector-length bytevector-u8-ref).
8 When comparing numbers where either number is complex, since non-real numbers cannot be compared with <, the following least-surprising ordering is defined: If the real parts are < or >, so are the numbers; otherwise, the numbers are ordered by their imaginary parts. This can still produce somewhat surprising results if one real part is exact and the other is inexact.
9 When comparing real numbers, it must use = and <.
10 When comparing strings, it must use string=? and string<?. Note: In R5RS, this is lexicographic order on the implementation-dependent order defined by char<?; in R6RS it is lexicographic order on Unicode codepoint order; in R7RS it is an implementation-defined order.
11 When comparing vectors, it must behave the same as a comparator returned by (make-vector-comparator (make-default-comparator) vector? vector-length vector-ref).
12 When comparing members of types registered with comparator-register-default!, it must behave in the same way as the comparator registered using that function.
Default comparators use default-hash as their hash function.

(
make-default-comparator
)
⟹
comparator?

(
make-eq-comparator
)
⟹
comparator?

make-eq-comparator, make-eqv-comparator, make-equal-comparator These procedures return comparators whose functions behave as follows:
1 The type test returns #t in all cases.
2 The equality functions are eq?, eqv?, and equal? respectively.
3 The ordering function is implementation-defined, except that it must conform to the rules for ordering functions. It may signal an error instead.
4 The hash function is default-hash.

(
make-eq-comparator
)
⟹
comparator?

(
make-equal-comparator
)
⟹
comparator?

(
make-equal-comparator
)
⟹
comparator?

(
make-eqv-comparator
)
⟹
comparator?

(
make-eqv-comparator
)
⟹
comparator?

(
make-icar-comparator
[
comparator?
comparator
]
)
⟹
comparator?

(
make-icar-comparator
[
comparator?
comparator
]
)
⟹
comparator?

(
make-icdr-comparator
[
comparator?
comparator
]
)
⟹
comparator?

(
make-icdr-comparator
[
comparator?
comparator
]
)
⟹
comparator?

(
make-ilist-comparator
[
comparator?
element-comparator
]
)
⟹
comparator?

(
make-ilist-comparator
[
comparator?
element-comparator
]
)
⟹
comparator?

(
make-improper-ilist-comparator
[
comparator?
element-comparator
]
)
⟹
comparator?

(
make-improper-ilist-comparator
[
comparator?
element-comparator
]
)
⟹
comparator?

(
make-ipair-comparator
[
comparator?
car-comparator
]
[
comparator?
cdr-comparator
]
)
⟹
comparator?

(
make-ipair-comparator
[
comparator?
car-comparator
]
[
comparator?
cdr-comparator
]
)
⟹
comparator?

(
make-list-comparator
[
comparator?
element-comparator
]
[
procedure?
type-test
]
[
procedure?
empty?
]
[
procedure?
head
]
[
procedure?
tail
]
)
⟹
comparator?

type-test
⟹
(
λ
obj
)
⟹
boolean?

empty?
⟹
(
λ
obj
)
⟹
boolean?

head
⟹
(
λ
obj
)
⟹
*

tail
⟹
(
λ
obj
)
⟹
*

This procedure returns comparators whose functions behave as follows:
1 The type test returns #t if its argument satisfies type-test and the elements satisfy the type test predicate of element-comparator.
2 The total order defined by the equality and ordering functions is as follows (known as lexicographic order):
2.1 The empty sequence, as determined by calling empty?, compares equal to itself.
2.2 The empty sequence compares less than any non-empty sequence.
2.3 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.
3 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.

(
make-list-comparator
[
comparator?
element-comparator
]
[
procedure?
type-test
]
[
procedure?
empty?
]
[
procedure?
head
]
[
procedure?
tail
]
)
⟹
comparator?

type-test
⟹
(
λ
obj
)
⟹
boolean?

empty?
⟹
(
λ
obj
)
⟹
boolean?

head
⟹
(
λ
obj
)
⟹
*

tail
⟹
(
λ
obj
)
⟹
*

This procedure returns comparators whose functions behave as follows:
1 The type test returns #t if its argument satisfies type-test and the elements satisfy the type test predicate of element-comparator.
2 The total order defined by the equality and ordering functions is as follows (known as lexicographic order):
2.1 The empty sequence, as determined by calling empty?, compares equal to itself.
2.2 The empty sequence compares less than any non-empty sequence.
2.3 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.
3 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.