Comment by jlokier

Comment by jlokier 10 days ago

4 replies

The names CAR and CDR weren't invented for Lisp or FLPL. They came from assembly language mnemonics on the IBM 704, where the first Lisp interpreter was implemented.

The original Lisp CAR and CDR operations used the machine-level instructions with those names on the IBM 704.

Cons cells were stored in single words of the 36-bit memory and 36/38-bit registers, and the CAR and CDR operations accessed the "address" and "decrement" 15-bit parts of a word, respectively.

kazinator 10 days ago

That's the legend, but they're actually no such instruction mnemonics.

The Address and Decrement terms and the fields of the 36-bit word they denote do come from the architecture.

There are instructions like LXA and LXD -- load index from address, load index from decrement.

lispm 9 days ago

probably there were no such machine-level instructions, but assembler macros

https://en.wikipedia.org/wiki/CAR_and_CDR

  • jlokier 9 days ago

    I felt it simplified the description to not mention they were assembler macros, but in retrospect, that was begging for a correction :-)

    The linked page with details was interesting, thanks!

    • kazinator 9 days ago

      The page doesn't say that these were predefined assembler macros provided by IBM. I'm tending toward the interpretation that the Lisp guys themselves (likely Russel) wrote these macros as part of the assembly language implementation of the interpreter. Which means they specified them to the assembler, rather than the other way around.