Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They make perfect sense once you understand what they do.

They're not mnemonic for any specific usage because they have more than one possible specific usage in the language.

Besides, what kind of sense does '+' make for addition? It's also purely historical.



Imagine you were tasked with implementing a linked-list in, let's say 'C', but anything really.

So you choose 'cell' as your name for a node. OK, that's .. fine.

Now you choose 'car' and 'cdr' for each cell's 'data pointer' and 'next-cell-in-list pointer'. How many 'WTF?s'* do you think you'd get in code review? (except from lispers, I guess)

* obviously it's a rhetorical question, no-one writes or says WTF (out loud) in actual code reviews I hope.


> Now you choose 'car' and 'cdr' for each cell's 'data pointer' and 'next-cell-in-list pointer'. How many 'WTF?s'* do you think you'd get in code review?

Your names are too verbose.


Cons cells aren't a linked list.


struct node_t* node

node->data

node->next

Zero "WTF"s


Except those names are wrong in some contexts. That's the point.


You are tasked with writing a binary tree, and you pick car and cdr ... A key-value tuple-space... Complex numbers...

The point is they are 'wrong' in every context. For LISt Processing, they should probably default to something to do with lists.

And caaar et al are a fine example of why I completely skipped common lisp in favour of newer lisp-likes. Perhaps it happens to all languages eventually, people add a convenience here, an shortcut there, and a doodad here, and before long you have an impenetrable thicket.

And these things seem convenient, but they are a huge extra cognitive load, and impose a further learning cost even to practicing experts who have to keep up with the latest doodads.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: