scripting language vs. developer community size

Bill Gribble grib@gnumatic.com
Tue, 16 Jan 2001 10:24:25 -0600


On Tue, Jan 16, 2001 at 09:09:51AM -0700, Clark Jones wrote:
> Just in case anyone's not aware of it, the "CAR" and "CDR" in Lisp (I'm
> not familiar with Scheme) are register names for a computer designed in
> the late 1950's.  (Please don't ask me what the acronyms stand for, or
> what the computer was -- I haven't dealt with that in about 15 or 20
> years.)  

The basic data structure in Scheme (and all LISP-like languages... in
fact LISP is an acronym for LIst PRocessing) is the singly-linked
list.  The backbone of the list is a chain of cells ("cons cells")
that have a pointer to the cell data and a "next" pointer to the
remainder of the list.  

In the IBM 704 both parts could be stored in one register, which had
two parts, the "address" part and the "decrement" part.  The "data"
pointer was stored in the "address" part and the "next" pointer was
stored in the "decrement" part.

There were special instructions for getting out the two parts of a
register, "Contents of the Address part of Register" (CAR) and
"Contents of the Decrement part of Register" (CDR).

So CAR gets you the first element of a list and CDR gets you all the
other elements.

Yes, it's crufty and apocryphal.  If it's THAT upsetting to see 'car'
and 'cdr' and friends, try this: 

   (define first car)
   (define rest cdr)

b.g.