3 ms·
As a total aside, the names `car` and `cdr` for "head" and "tail" are honestly some of the most baffling historical relics in all of computing.
by Sharlin 6d ago
As a total aside, the names `car` and `cdr` for "head" and "tail" are honestly some of the most baffling historical relics in all of computing.
- MiroslavPokorny 6d agoWhat i dont understand is why does everything have to be so brief. Take car and cdr there is only one character difference, more character differences is a good thing not bad.
- thaumasiotes 6d ago> What i dont understand is why does everything have to be so brief. The concept is to make things easier for people who are familiar with the language. Making things harder for that group is always counterproductive, because they are the only people who can do any useful work.
- MiroslavPokorny 6d agoIf a person cant handle typing a 8 character var name and can only handle short names that are 3 chars, then you have a much bigger problem.
- gumby 6d agoMore short names fit in your fovea than long names so for the most common operations they are the easiest to read. It’s the same reason the most common words in human languages are the shortest (and programming languages are for humans to use so subject to the same pressure. Also, Back In The Old Days memory was very expensive and precious so short identifiers were important. Often labels were tightly constrained, for example being limited to six upper-case characters so they would fit in a single word.
- Sharlin 6d agoThe usual convention (which also occurs in natural languages) is that often-used words should be short, rarely used should (and can afford to be) more descriptive.
- kgwgk 6d agoWhy waste time say (write) lot (long) word when few (short) word do trick?
- MiroslavPokorny 6d agoMost people actually write small amounts of code in a day, saving a single character here and there typing hardly matters. Its a saving that amounts to seconds for a days work. More characters on the other hand prevents many potential types of mistakes, such as meaning one statement of target and actually entering another.
- jiggawatts 6d agoEveryone else is just guessing. The real reason is that these were three-letter abbreviations from IBM assembly language: CAR = Contents of the Address part of Register CDR = Contents of the Decrement part of Register This kind of TLA is common in assembly languages and LISP just inherited this because early implementation used these literal instructions.
- Sharlin 6d agoNo, everybody else is talking about short identifiers in general which is what the GP asked about. For car and cdr specifically you’re right, of course. I also love how the register names don’t even have ANY mnemonic relation to what the contents mean in Lisp. Address and Decrement? Totally arbitrary. It’s like having a high-level language where function parameters are always names rsi, rdi, and so on. Because obviously "destination index" means "first argument"!
- jiggawatts 6d agoI agree, I too think this is all nuts. Something I tell junior developers: There is one way to correctly spell out a word in full, but many different ways of abbreviating it. Don't make me guess or memorise which one you chose, completely arbitrarily. UNIX and languages "born from it" are especially prone to a ludicrous level of abbreviation because of its start in the earliest days of computing when serious machines had mere kilobytes of memory, and so every byte was precious. Compounding that were the use of teletypewriters, which did not generally allow edits and were glacially slow. Tab complete was impossible. This has become so ingrained in the early generation of computing science pioneers that they passed on these behaviours almost like religious doctrine, like dogma or rituals that must be preserved. Perhaps it was mostly subconsciously done, but I have seen programmers in the 90s and early 2000s still instructing others to do these things, to shave bits and bytes off identifiers to 'save space'.
- kaoD 6d ago> What i dont understand is why does everything have to be so brief Computers used to have very little memory and processing power, and screens had very low pixel density so line width was not that big. Then you have to deal with the baggage 50 years later. Modern Lisps have the luxury so they use head/tail or first/rest.
- Mikhail_Edoshin 6d agoNames need to express not only differences, but also similarity.
- drysine 5d ago>What i dont understand is why does everything have to be so brief. Look at the words in the Swadesh list[0]. They are all short. [0] https://en.wikipedia.org/wiki/Swadesh_list https://en.wikipedia.org/wiki/Swadesh_list