common lisp - Default :test in MEMBER doesn't find '(A B) in '((A B)) -


what default test member uses when searching list, , why fail find list? using gnu clisp 2.49.

>(setq x '(a b)) >(member x '((a b))) nil >(member x (list x)) ((a b)) >(equal (list x) '((a b))) t >(member x '((a b)) :test #'equal) ((a b)) 

it's not obvious find answer this. browsing hyperspec @ higher level can helpful. while can tedious first couple of times, you'll lot out of documentation, , it's "reusable"—the answers lots of similar questions in same place.

in case, jkiiski mentioned in comments, answer in 17.2.1 satisfying two-argument test, states:

if neither :test nor :test-not argument supplied, if :test argument of #'eql supplied.

(note: it's worth noting , doesn't say. doesn't default value of test argument #'eql, , doesn't if value of test or test-not argument nil, #'eql used. point out not test, related key argument can nil or not provided, in case though #'identity used.)

it lists functions applies to, describes how arguments test (or test-not) function computed (based on key argument), , other useful tidbits of information.

while you're in section, it's worth browsing "up" parent section, 17.2 rules test functions, , grandparent section, 17. sequences, , having through those.


Comments