generalized-boolean—a generalized boolean.
Returns true if x and y are structurally similar
(isomorphic) objects. Objects are treated as follows by
equal is true of two objects
if they are symbols that are
if they are numbers that are
if they are characters that are
equal is defined recursively as
the two cars being
and the two cdrs being
Two arrays are
equal only if they are
with one exception:
strings and bit vectors are compared element-by-element (using
If either x or y has a fill pointer, the
fill pointer limits
the number of elements examined by
Uppercase and lowercase letters in strings are considered by
equal to be different.
Two pathnames are
equal if and only if
all the corresponding components
(host, device, and so on) are
equivalent. Whether or not
uppercase and lowercase letters are considered equivalent
in strings appearing in components is implementation-dependent.
equal should be functionally equivalent.
Two other objects are
equal only if they are
equal does not descend any objects other than the
ones explicitly specified above.
The next figure summarizes the information given in the previous list.
In addition, the figure specifies the priority of the behavior of
entries taking priority over lower ones.
Figure 5.12: Summary and priorities of behavior of
Any two objects that are
eql are also
equal may fail to terminate if x or y is circular.
(equal 'a 'b) → false (equal 'a 'a) → true (equal 3 3) → true (equal 3 3.0) → false (equal 3.0 3.0) → true (equal #c(3 -4) #c(3 -4)) → true (equal #c(3 -4.0) #c(3 -4)) → false (equal (cons 'a 'b) (cons 'a 'c)) → false (equal (cons 'a 'b) (cons 'a 'b)) → true (equal #\A #\A) → true (equal #\A #\a) → false (equal "Foo" "Foo") → true (equal "Foo" (copy-seq "Foo")) → true (equal "FOO" "foo") → false (equal "This-string" "This-string") → true (equal "This-string" "this-string") → false
eq, eql (Function), equalp, =, string=, string-equal, char=, char-equal, tree-equal
Object equality is not a concept for which there is a uniquely
determined correct algorithm. The appropriateness of an equality
predicate can be judged only in the context of the needs of some
particular program. Although these functions take any type of
argument and their names sound very generic,
not appropriate for every application.
A rough rule of thumb is that two objects are
if and only if their printed representations are the same.