The Origins of car and cdr in Lisp

Posted on March 2, 2025 by Bruno G. Ciccarino

In Lisp, a cons cell is a fundamental building block of linked lists. Each part of a cons cell has a specific name with a historical background, both derived from the IBM 704. If you want to delve deeper into the concept of cons cells, I wrote this article that explains the concept of lists and cons cells in more detail, I recommend you take a look Under the Hood of Lists - A Low-Level Exploration of Cons Cells in Lisp.

The IBM 704 is an incredibly old computer by today’s standards—it used vacuum tubes! However, it was revolutionary for its time, being the first mass-produced computer to use magnetic core memory for data storage. It was also (if I’m not mistaken) the first computer capable of performing floating-point arithmetic.

The Meaning Behind car and cdr

Where do the names car and cdr come from? The IBM 704 had 36-bit memory registers, and these registers were divided into distinct sections. Two of these sections were particularly important:

  • CAR = Contents of Address portion of Register
  • CDR = Contents of Decrement portion of Register

The CAR represented the first portion of the register (bits 21–35), while the CDR, pronounced as “coder,” represented the second portion (bits 3–17).

In Lisp, car and cdr were introduced to return the first part of a cons cell (car) and the remainder of the list (cdr).

> (car '(a b c))
A
> (cdr '(a b c))
(B C)

Using car and cdr, you can navigate to any element in a list. For example, if you want the third element, you can use the third function (which uses car and cdr under the hood):

> (third '(a b c d))
C

This is much cleaner than chaining car and cdr manually:

> (car (cdr (cdr '(a b c d))))
C

The historical origins of car and cdr may seem obscure today, but their functionality remains essential in Lisp programming!