libera/#commonlisp - IRC Chatlog
Search
8:25:10
beach
This page says ALIST is an association list. And the glossary says that an association list is a list of conses.
8:27:01
beach
It gives two almost equivalent expressions, but they are equivalent only if NIL is a member of the association list. But then, it is not an association list, now is it?
8:28:32
beach
If I were to implement ASSOC, I would take the wording in the "Exceptional situations:" section to mean that if I detect that I don't have a proper list, or if I detect that an element is not a CONS cell, then I would signal an error.
8:29:08
beach
And that I don't have to search beyond a matching element to find out whether it is really an association list.
8:31:51
beach
And the error message hints that SBCL considers an association list to be a list of elements of type LIST, rather than (as the glossary says) a list of elements of type CONS.
8:40:36
Equill
I don't like it either, but this appears to be a case of duck-typing: both `(listp nil)` and `(atom nil)` return `t`, so the crucial test in this case is whether an element is considered a list, rather than whether it's (possibly _also_) some other type.