News for hackers. Stuff that matters.
Re:Common Lisp in the 21st Century by adwf on Monday February 10, 2014 @04:16PM (#7213893)
I assume that historically it's because they were trying to keep function names short to help save memory, don't forget Lisp in one form or another has been around for a loooong time.

A lot of the time there are more descriptive alternatives: car -> first, cdr -> rest, elt -> nth, etc... However, these are also complained about by a lot of people as unnecessarily bloating the language! (plus, elt/nth manage to invert their argument order, doh...)

So it's kind of a no-win situation really. But I like this attempt to provide a common substrate and hope that it will succeed where others have failed.

Re:Common Lisp in the 21st Century by jlarocco on Monday February 10, 2014 @04:57PM (#7214157)
Actually, car and cdr in particular were named after the instructions used to implement them in IBM 704 assembly language. [1]

The cryptic naming and backwards compatibility with completely out dated 40 year old systems are just a few things that drive me crazy about Lisp.

    [1] https://en.wikipedia.org/wiki/CAR_and_CDR
Re:Common Lisp in the 21st Century by lispm on Monday February 10, 2014 @05:32PM (#7214307)
Why should we throw away old code?

In your own code, you can use FIRST and REST for lists.

But if you want to program you need to deal with that. Stuff was there before you and has a history. Changing things has a benefit, but also a cost. For a small community like Lisp, constantly rewriting code because some names change is not such a good idea.

Given that we can remember thousands of words in natural languages, a few hundred core words of a programming language is not such a huge hurdle.

Re:Common Lisp in the 21st Century by mcn on Monday February 10, 2014 @07:32PM (#7214827)
Another issue is old books. I recently got value out of PAIP and On Lisp, and I still see people recommend A Gentle Introduction to Symbolic Computation. Stepping beyond CL for a second, car and cdr have even deeper roots; for example if someone is introduced to the wider lisp-like world through SICP they will also have to become comfortable with car and cdr.
Re:Common Lisp in the 21st Century by coldtea on Monday February 10, 2014 @10:41PM (#7215639)
>Why should we throw away old code?

For the same reason we move forward and left Algol in the past, relegated Cobol to some niche areas, etc.

Re:Common Lisp in the 21st Century by brudgers on Monday February 10, 2014 @05:54PM (#7214398)
That car and cdr can be aliased easily by any Lisp programmer might lead a person to wonder why they survive and are even included in more modern Lisps such as Racket.

The reason is the expressive power of their extended versions - e.g. caadr or cdaar don't have easily derived equivalents from first and rest and those that can be derived are at best equally bad or worse...ffirest and reffst anyone?

Re:Common Lisp in the 21st Century by Derbasti on Monday February 10, 2014 @06:09PM (#7214459)
What's wrong with "second"?
Re:Common Lisp in the 21st Century by brudgers on Monday February 10, 2014 @06:31PM (#7214552)
Nothing and Common Lisp includes second. But that's not caar. It returns the first element of the first element of a list - the extended forms of car and cdr are for nested lists and nested lists can be used to implement many different data structures [and are also the data structure containing Lisp programs].

The extended forms of car and cdr provide a form of expression which is not obvious based on the construction of common non-Lisp languages even those that have very flexible lists and dynamic typing.

Re:Common Lisp in the 21st Century by Derbasti on Tuesday February 11, 2014 @02:08AM (#7216281)
I know, so do (head (second list)), or if you must, (head2 list) or even (head list 2) or something. Still much more readable than cadr
Re:Common Lisp in the 21st Century by AnimalMuppet on Monday February 10, 2014 @06:19PM (#7214503)
I presume you mean as opposed to "rest".

The problem is, it really is "rest" instead of "second", at least in the usual case. Yes, a cons cell can contain pretty much any two things, but the most-frequently-used case (or so I believe) is that of a list. In that case, "car" means "first element of the list", and "cdr" means "the entire rest of the list", not "the second element of the list".

Re:Common Lisp in the 21st Century by frou_dh on Monday February 10, 2014 @08:08PM (#7214997)
Personally I have found it useful to keep in mind that it's the pair that's fundamental and not the list. IIRC it was pg that made the point somewhere that car and cdr are acceptable because there really aren't any slam-dunk general terms for the parts of a pair.
Re:Common Lisp in the 21st Century by AnimalMuppet on Monday February 10, 2014 @08:43PM (#7215139)
True, and if you're thinking of them as a pair, then "first" and "second" are appropriate. But if you're using them to implement a list, then "second" is misleading.
Re:Common Lisp in the 21st Century by frou_dh on Monday February 10, 2014 @10:26PM (#7215588)
I'd probably go with "left" and "right" to get away from the implication of priority. I didn't type this using my first and second hands.

(bikeshedding acknowledged)