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

'first' and 'rest' for 'car' and 'cdr' are obviously better, because they say what's going on, and that's why some people are already using them. I'm not sure if there's a good term that's not already used for 'cons'. Maybe 'Join' or something.

Do I even need to justify why these are better names? The problem is not that people don't know about better names. Everyone does [0]. My issue is that this doesn't seem to bother people.

[0]: https://www.gnu.org/software/emacs/manual/html_node/eintr/St...



The problem is that FIRST and REST doesn't cover the whole idea of cons cells. That's why the old names still exist.

The Lisp practice for 40 years is to use FIRST, REST, LIST, APPEND, LIST*, ... when we speak about List Processing.

CONS, CAR and CDR are used when cons cells are used for things like trees, graphs and other data structures. It's an indicator that the code is very low-level and used for assembling other data structures from cons cells.


> 'first' and 'rest' for 'car' and 'cdr' are obviously better, because they say what's going on

I sometimes use cons cells for binary trees - first and rest are misleading in that case. I very often use cons cells to define things - the car is some object and the cdr is some property or definition that applies to the object. first and rest are misleading for that use case.

What you are proposing is to use domain-specific names for operations on an abstract data structure. Any names with pre-existing meaning will become misleading as soon as the data structure is applied to a different application. Coming up with new terminology to unambiguously refer to new technical concepts is not a "problem," it is a means of effective communication.




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

Search: