Cons - Use

Use

Although cons cells can be used to hold ordered pairs of simplex data, they are more commonly used to construct more complex compound data structures, notably lists and binary trees.

For example, the Lisp expression (cons 1 2) constructs a cell holding 1 in its left half (the so-called car field) and 2 in its right half (the cdr field). In Lisp notation, the value (cons 1 2) looks like:

(1 . 2)

Note the dot between 1 and 2; this indicates that the S-expression is a "dotted pair," rather than a "list."

Read more about this topic:  Cons

Famous quotes containing the word use:

    ... it is use, and use alone, which leads one of us, tolerably trained to recognize any criterion of grace or any sense of the fitness of things, to tolerate ... the styles of dress to which we are more or less conforming every day of our lives. Fifty years hence they will seem to us as uncultivated as the nose-rings of the Hottentot seem today.
    Elizabeth Stuart Phelps (1844–1911)