I'm just starting to learn Common Lisp and the text I'm reading uses an example with the member function.
I'm unsure of the distinction between these two blocks of code:
(if (member nil '(1 nil 2 3))
'contains-nil
'does-not-contain-nil)
returns CONTAINS_NIL
(if (member nil '(1 2 3))
'contains-nil
'does-not-contain-nil)
returns DOES-NOT-CONTAIN-NIL
From what I understand, lists are equivalent to nested cons cells, so I would think (member nil (cons 1 (cons 2 (cons 3 nil))) would return (nil), but it just returns nil. I'm not sure how a compiler or interpreter would make that distinction, and if someone could give me some insight on how I could implement the member function, I'd appreciate it.