(if (member* element (symbol-value list-var)
:test (or compare-fn #'equal))
Since subr.el is dumped before cl.el, I wanted to make sure that if anything
pre-CL did call add-to-list, it'd at least work if they avoided the :test
case. But nothing seems to, so I suppose this would be safe?
instead? Or for efficiency (does that ever matter here?)
;; member and memq are implemented in C
(if (cond ((eq compare-fn #'eq) (memq element (symbol-value list-var)))
((null compare-fn) (member element (symbol-value list-var)))
((member* element (symbol-value list-var) :test compare-fn)))
Do we have any use cases for :test functions other than member?
Emacs also seems to offer a memql, but I'm not sure how much use it is other
As for :test, it's also used in make-hash-table.
XEmacs-Patches mailing list