|
"CADR" redirects here. This was also the name of the second version of MIT's Lisp machine.
Introduced in the Lisp programming language, car (pronounced /ˈkɑr/, just like the English word "car") and cdr (/ˈkʌdər/ or /ˈkʊdər/) are primitive operations upon linked lists composed of cons cells. A cons cell is composed of two pointers; the car operation extracts the first pointer, and the cdr operation extracts the second. Thus, the expression When cons cells are used to implement singly-linked lists (rather than trees and other more complicated structures), the car operation returns the first element of the list, while cdr returns the rest of the list. For this reason, the operations are sometimes given the names first and rest or head and tail. Origin of the names car and cdrLisp was originally implemented on the IBM 704 computer, in the late 1950s. The 704 hardware had special support for splitting a 36-bit machine word into four parts, an "address part" and "decrement part" of 15 bits each and a "prefix part" and "tag part" of three bits each. Precursors to Lisp included functions car (short for "Contents of the Address part of Register number"), cdr ("Contents of the Decrement part of Register number"), cpr and ctr, each of which took a machine address as an argument, loaded the corresponding word from memory, and extracted the appropriate bits. The 704 assembler macro for
A machine word could be reassembled by cons, which took four arguments (a,d,p,t). The prefix and tag parts were dropped in the early stages of Lisp's design, leaving CAR, CDR, and a two-argument CONS.[2] The names References
|
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.