3.2 Equality Predicates

This package defines the Common Lisp predicate cl-equalp.

Function: cl-equalp a b

This function is a more flexible version of equal. In particular, it compares strings case-insensitively, and it compares numbers without regard to type (so that (cl-equalp 3 3.0) is true). Vectors and conses are compared recursively. All other objects are compared as if by equal.

This function differs from Common Lisp equalp in several respects. First, Common Lisp’s equalp also compares characters case-insensitively, which would be impractical in this package since Emacs does not distinguish between integers and characters. In keeping with the idea that strings are less vector-like in Emacs Lisp, this package’s cl-equalp also will not compare strings against vectors of integers.

Also note that the Common Lisp functions member and assoc use eql to compare elements, whereas Emacs Lisp follows the MacLisp tradition and uses equal for these two functions. The functions cl-member and cl-assoc use eql, as in Common Lisp. The standard Emacs Lisp functions memq and assq use eq, and the standard memql uses eql.