[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thx almost everyone



In article <199504171542.IAA03175@ministry.cambridge.apple.com>
reti@cambridge.apple.com (Kalman Reti) writes:

>At 19:03 4/16/95 -0500, Ken Tilton wrote:

>>BTW, what's this "car" and "cdr" I see all over the place?

>They are old names for "first" and "rest".  The date back to the
>implementation of Lisp on an old IBM machine (704 I believe) where the two
>halves of a cons were kept in two registers.  CAR stands for "contents of
>address register" and represents the instruction used to get the first element
>of the cons.  CDR is similarly contents of decrement register.

It was the 704.

The 704 was a 36-bit machine, with 15-bit addresses.  A memory word or register
could therefore hold two addresses, along with a 3-bit index-register spec and
a 3-bit tag.  The two 15-bit portions were used by looping instructions to hold
the ADDRESS and the DECREMENT.  So the correct reading of CAR and CDR is
"Contents of Address (resp. Decrement) *part* of Register."

In the original implementation of LISP, done as a set of FORTRAN subroutines,
you find not only CAR and CDR, but also CTR and CXR.  John McCarthy has stated
that these turned out not to be very useful.

>Their use is considered old-fashioned at best (and poor style at worst) these
>days.

And in some Lisps are still the default:  E-Lisp, for example.  Which may or
may not be in contradistinction to Mr. Reti's statement.
-- 
Rich Alderson   You know the sort of thing that you can find in any dictionary
                of a strange language, and which so excites the amateur philo-
                logists, itching to derive one tongue from another that they
                know better: a word that is nearly the same in form and meaning
                as the corresponding word in English, or Latin, or Hebrew, or
                what not.
                                                --J. R. R. Tolkien,
alderson@netcom.com                               _The Notion Club Papers_