Next: , Previous: Booleans, Up: Top


4 Equivalence

Kernel has two general-purpose equivalence predicates (whereas R5RS Scheme has three). The two Kernel predicates correspond to the abstract notions of equivalence up to mutation (equal) and equivalence in the presence of mutation (eq?).

— Applicative: eq? (eq? . objects)

Predicate eq? returns true iff all of objects are effectively the same object, even in the presence of mutation.

— Applicative: equal? (equal? . objects)

Predicate equal? returns true iff all of objects “look” the same as long as nothing is mutated. This is a weaker predicate than eq?; that is, equal? must return true whenever eq? would return true.