CAR and CDR
In computer programming, CAR (codice_1) and CDR (codice_2) ( or ) are primitive operations on cons cells (or "non-atomic S-expressions") introduced in the Lisp programming language. 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 codice_3 evaluates to codice_4, and codice_5 evaluates to codice_6. 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". Etymology. Lisp was originally implemented on the IBM 704 computer, in the late 1950s. The popular explanation that "CAR" and "CDR" stand for "Contents of the Address Register" and "Contents of the Decrement Register" does not quite match the IBM 704 architecture; the IBM 704 does not have a programmer-accessible address register and the three address modification registers are called "index registers" by IBM. The 704 and its successors have a 36-bit word length and a 15-bit address space. These computers  had two instruction formats, one of which, the Type A, had a short, 3-bit, operation code prefix and two 15-bit fields separated by a 3-bit tag. The first 15-bit field was the operand address and the second held a decrement or count. The tag specified one of three index registers. Indexing was a subtractive process on the 704, hence the value to be loaded into an index register was called a "decrement". The 704 hardware had special instructions for accessing the address and decrement fields in a word. As a result it was efficient to use  those two fields to store within a single word the two pointers needed for a list. Thus, "CAR" is "Contents of the Address "part" of the Register". The term "register" in this context refers to "memory location". Precursors to Lisp included functions: each of which took a machine address as an argument, loaded the corresponding word from memory, and extracted the appropriate bits. 704 macros. The 704 assembler macro for codice_1 was: LXD JLOC 4 # C( Decrement of JLOC ) → C( C ) # Loads the Decrement of location JLOC into Index Register C CLA 0,4 # C( 0 - C( C ) ) → C ( AC ) # The AC register receives the start address of the list PAX 0,4 # C( Address of AC ) → C( C ) # Loads the Address of AC into Index Register C PXD 0,4 # C( C ) → C( Decrement of AC ) # Clears AC and loads Index Register C into the Decrement of AC The 704 assembler macro for codice_2 was: LXD JLOC 4 # C( Decrement of JLOC ) → C( C ) # Loads the Decrement of location JLOC into Index Register C CLA 0,4 # C( 0 - C( C ) ) → C( AC ) # The AC register receives the start address of the list PDX 0,4 # C( Decrement  of AC ) → C( C ) # Loads the Decrement of AC into Index Register C PXD 0,4 # C( C ) → C( Decrement of AC ) # Clears AC and loads Index Register C into the Decrement of AC 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. Compositions. Compositions of codice_1 and codice_2 can be given short and more or less pronounceable names of the same form. In Lisp, codice_15 is the equivalent of codice_16; its  value is codice_17. Similarly, codice_18 (pronounced ) is the same as codice_19; its value is codice_20. Most Lisps, for example Common Lisp and Scheme, systematically define all variations of two to four compositions of codice_1 and codice_2. Other computer languages. Many languages (particularly functional languages and languages influenced by the functional paradigm) use a singly linked list as a basic data structure, and provide primitives or functions similar to codice_1 and codice_2. These are named variously codice_25 and codice_26, codice_27 and codice_28, etc. In Lisp, however, the cons cell is not used only to build linked lists but also to build  pair and nested pair structures, i.e. the codice_2 of a cons cell need not be a list. In this case, most other languages provide different primitives as they typically distinguish pair structures from list structures either typefully or semantically. Particularly in typed languages, lists, pairs, and trees will all have different accessor functions with different type signatures: in Haskell, for example, codice_1 and codice_2 become codice_32 and codice_33 when dealing with a pair type. Exact analogues of codice_1 and codice_2 are thus rare in other languages. Clojure uses first instead of car and next or rest instead of cdr. CAR