21602MR@MSU.BITNET (Mark Rosenberg) (09/11/89)
I'm just starting to lean lisp and have a quick question, what does CAR and CDR stand for ? I can understand LOOP, SETQ, IF, etc... but CAR & CDR don't seem to relate their functionality..... Thanks, Mark Rosenberg <21602MR@MSU> Education Systems Development Michigan State University
barmar@think.COM (Barry Margolin) (09/12/89)
In article <11521602MR@MSU> 21602MR@MSU.BITNET (Mark Rosenberg) writes: >what does CAR and CDR stand for ? They are remnants of the first Lisp implementation, for the IBM 709 (or maybe 704?), and were the opcodes used on that machine to implement these operations. They stand for Contents of Address Register and Contents of Decrement Register. The address register and decrement register were the two halves of indirect pointers in memory, which were used to implement cons cells. Be thankful Lisp wasn't first implemented on the PDP-10, or I think they'd be named things like HRRZ and HLRZ. >but CAR & CDR don't seem to relate their functionality..... OK, what would you call them? The existing names are perfect precisely because they are meaningless! FIRST and REST are equivalent to CAR and CDR, but only make sense when the cons cell is being treated as the head of a list; they aren't appropriate for a tree structure. LEFT/RIGHT or CONS-PART-1/CONS-PART-2 imply a spatial relationship or ordering that is not inherent in the objects (Hebrew- and Arabic-speaking people might prefer to draw their cons cell chains from right to left, so the CAR would be on the right, but I learned to draw them with the CAR on the left). A cons is just an object with two cells, and it can be used to build arbitrary structures. Since there is no forced distinction between the two cells (except that they be separate from each other), the names we give them are arbitrary. Perhaps we should call them BROTHER-DARYL and OTHER-BROTHER-DARYL (comments to rec.arts.tv). Barry Margolin Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar
gateley@m2.csc.ti.com (John Gateley) (09/12/89)
In article <29265@news.Think.COM> barmar@think.COM (Barry Margolin) writes: >In article <11521602MR@MSU> 21602MR@MSU.BITNET (Mark Rosenberg) writes: >>what does CAR and CDR stand for ? >[Explanation of source of the names] And of course, car and cdr chains are marginally pronouncable: cadr = Cad-der cdar = could-ar etc. John gateley@m2.csc.ti.com
bill@cambridge.apple.com (Bill St. Clair) (09/14/89)
As I heard it, CAR is Contents of Address Register, and CDR is Contents of Decrement Register. These were hardware registers used in one of the early implementations of Lisp. Bill St. Clair (bill@CAMBRIDGE.APPLE.COM)