3 ms·
I think that there is a utility to the odd names. 'cons' is really just a pair while 'car' and 'cdr' are just the first and second member of that pair respectiv
by astine 9y ago
I think that there is a utility to the odd names. 'cons' is really just a pair while 'car' and 'cdr' are just the first and second member of that pair respectively, but this pair is a specific kind of pair for a specific kind of purpose so it makes sense to have a special jargon for it. It makes sense not to pollute the global namespace by reserving such common words and it helps to know immediately that one is talking about specifics of the Lisp list implementation. I suppose that some might prefer to not have to worry about the specifics of Lisp list implementation at all (Clojure manages this pretty well), but I think that having that kind or relatively low-level access has its uses.
(All things considered, I don't think that 'for' or 'switch' are any clearer, anyway.)