Monday, November 26, 2007

Origin of CAR and CDR

“It was soon noticed that extraction of a subexpression involved composing the extraction of the address part with cwr and that continuing along the list involved composing the extraction of the decrement part with cwr. Therefore, the compounds car, standing for ``Contents of the Address part of Register number'', and its analogs cdr, cpr, and ctr were defined. The motivation for implementing car and cdr separately was strengthened by the vulgar fact that the IBM 704 had instructions (connected with indexing) that made these operations easy to implement.”
--- John McCarthy, History of Lisp

The IBM 704 was not an early lisp machine.

2 comments:

  1. > by the vulgar fact

    What an odd way to characterize such an important "accident of architecture". I guess even pioneering geniuses aren't immune to missing the forest through the trees. Were the first mutations that led to vision or intelligence in life, in fact, "vulgar"? Car/cdr were hardware abstractions, at least. Is Emacs/Slime/SBCL any more of a "Lisp Machine" than the 704? More of an emulator, IMO -- VOPs being somewhat of a "microcode".

    ReplyDelete
  2. I suppose MCarthy meant "vulgar" in the sense of Vulgar Latin, that is, not having higher-level term for it at the time -- not in the sense of "a vulgar joke". (My own understanding of language seems to get increasingly vulgar over time.) It is interesting that I still use "car/cdr" in my code and not "first/rest". Why do we say "damn!" when we stub our toe, and not "perceptible injury!"?

    ReplyDelete