Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you have a mnemonic for remembering the meaning of car and cdr?

Most of my Lisp experience comes from Elisp. As such, I find myself writing Lisp only on occasion. By the time I come back to it, I often forget the difference between car and cdr and need to reference the docs to jog my memory.

What kinds of clever mnemonics do you use to remember the difference between Lisp functions that have naming roots stemming from 1954 era computer architectures (car, cdr, cadr, caar, cddr, etc)?

In addition, why haven't the well-named aliases of first and rest gained more traction as idiomatic alternatives for car and cdr?

Update: I know the actual definitions of car and cdr and how they should be pronounced. Mnemonics only please.

Full Disclosure: This question isn't entirely for me. It's to help other Lisp newcomers get past some of the initial hurdles.

like image 476
Ryan McGeary Avatar asked Aug 20 '09 02:08

Ryan McGeary


People also ask

What does CAR and CDR stand for?

The popular explanation that CAR and CDR stand for "Contents of the Address Register" and "Contents of the Decrement Register" does not quite match the IBM 704 architecture; the IBM 704 does not have a programmer-accessible address register and the three address modification registers are called "index registers" by ...

Why are car and CDR so named?

The origins of the names for car and cdr are a little bit historical and comes from the IBM 704. car is an acronym from the phrase Contents of the Address part of the Register; and cdr is an acronym from the phrase Contents of the Decrement part of the Register.

What does car do in Lisp?

The car and cdr functions are used for splitting lists and are considered fundamental to Lisp. Since they cannot split or gain access to the parts of an array, an array is considered an atom. Conversely, the other fundamental function, cons , can put together or construct a list, but not an array.


1 Answers

Of the two words car and cdr, car is the one I've heard first.

like image 128
Eisen Avatar answered Oct 17 '22 01:10

Eisen