Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why are CAR and CDR called that?

called car CDR
0
Posted

Why are CAR and CDR called that?

0

\cl{CAR} and \cl{CDR} are the fundamental accessors for the head of a

0

CAR and CDR are the fundamental accessors for the head of a list and the rest of a list. Their names come from the names of two assembler macros on the IBM 704 mainframe. These macros were used to extract two memory addresses from a 36bit register. CAR is an abbreviation of contents of address of register whilst CDR is for contents of decrement of register. The assembler macros ended up with a home in lisp itself since they formed the basic computer operations on the 704 to perform what we can refer to as FIRST and REST. CAR and CDR survive in modern Common Lisp mostly for nostalgia reasons and also because of an interesting set of abbreviations they allow. By forming new abbreviations such as CADR and CAADDR we treat each a as a CAR and each d as a CDR. So CADR is an abbreviated form of (car (cdr lst)) and CAADDR is an abbreviation of (car (car (cdr (cdr lst)))) This is called “composability” and so people like the names “CAR” and “CDR” because they’re “composable”. One point of view

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.