Function: cl-equalp
cl-equalp is an autoloaded and byte-compiled function defined in
cl-extra.el.gz.
Signature
(cl-equalp X Y)
Documentation
Return t if two Lisp objects have similar structures and contents.
This is like equal, except that it accepts numerically equal
numbers of different types (float vs. integer), and also compares
strings case-insensitively.
Other relevant functions are documented in the comparison and string groups.
Shortdoc
;; string
(cl-equalp "Foo" "foo")
=> t
;; comparison
(cl-equalp 2 2.0)
=> t
(cl-equalp "ABC" "abc")
=> t
Aliases
equalp (obsolete since 27.1)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-extra.el.gz
;;; Predicates.
;;;###autoload
(defun cl-equalp (x y)
"Return t if two Lisp objects have similar structures and contents.
This is like `equal', except that it accepts numerically equal
numbers of different types (float vs. integer), and also compares
strings case-insensitively."
(cond ((eq x y) t)
((stringp x)
(and (stringp y) (string-equal-ignore-case x y)))
((numberp x)
(and (numberp y) (= x y)))
((consp x)
(while (and (consp x) (consp y) (cl-equalp (car x) (car y)))
(setq x (cdr x) y (cdr y)))
(and (not (consp x)) (cl-equalp x y)))
((vectorp x)
(and (vectorp y) (= (length x) (length y))
(let ((i (length x)))
(while (and (>= (setq i (1- i)) 0)
(cl-equalp (aref x i) (aref y i))))
(< i 0))))
(t (equal x y))))