What does "my other car is a cdr" mean?

CaptainCasey picture CaptainCasey · Dec 8, 2009 · Viewed 38.5k times · Source

Can anyone well versed in lisp explain this joke to me? I've done some reading on functional programming languages and know that CAR/CDR mean Contents of Address/Decrement Register but I still don't really understand the humour.

Answer

Peter S. Housel picture Peter S. Housel · Dec 8, 2009

In Lisp, a linked list element is called a CONS. It is a data structure with two elements, called the CAR and the CDR for historical reasons. (Some Common Lisp programmers prefer to refer to them using the FIRST and REST functions, while others like CAR and CDR because they fit well with the precomposed versions such as (CADR x) ≡ (CAR (CDR x)).

The joke is a parody of the bumper stickers you sometimes see on beat-up old cars saying "My other car is a Porsche/BMW/etc."

My response to this joke has always been "My other CAR is a CADR. CDR isn't a CAR at all."