The pair is a fundamental PSL data type, and is one of the major attractions of LISP programming. A pair consists of a two-item structure. In PSL the first element is called the car and the second the cdr; in other LISPs, the physical relationship of the parts may be different. An illustration of the tree structure is given below as a box diagram; the car and the cdr are each represented as a portion of the box.
As an example, a tree written as ((A . B) . (C . D)) in dot-notation is drawn below as a box diagram.
The box diagrams are tedious to draw, so dot-notation is normally used. Note that a space is left on each side of the . to ensure that pairs are not confused with floats.
A list is a special case of a dotted pair structure. A list is either
List notation in general is a lot easier to read than the equivalent dotted pair notation.
The following is an algorithm for writing a dotted pair structure in list notation.