equal
x y => generalized-boolean
x---an object.
y---an object.
generalized-boolean---a generalized boolean.
Returns true if x and y are structurally similar (isomorphic) objects. Objects are treated as follows by equal.
equal does not descend any objects other than the ones explicitly specified above. Figure 5--12 summarizes the information given in the previous list. In addition, the figure specifies the priority of the behavior of equal, with upper entries taking priority over lower ones.
Type Behavior number uses eql character uses eql cons descends bit vector descends string descends pathname "functionally equivalent" structure uses eq Other array uses eq hash table uses eq Other object uses eq
Figure 5--12: Summary and priorities of behavior of equal
Any two objects that are eql are also equal.
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
section eq [Function] , section eql [Function] , section equalp [Function] , @xref{=; /=; <; >; <=; >=} , @xref{string=; string/=; string<; string>; string<=; string>=; string-equal; string-not-equal; string-lessp; string-greaterp; string-not-greaterp; string-not-lessp} , string-equal, @xref{char=; char/=; char<; char>; char<=; char>=; char-equal; char-not-equal; char-lessp; char-greaterp; char-not-greaterp; char-not-lessp} , char-equal, section tree-equal [Function]
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, equal and equalp are not appropriate for every application.
A rough rule of thumb is that two objects are equal if and only if their printed representations are the same.
Go to the first, previous, next, last section, table of contents.