Drawing Box Diagrams of List Structure
A ``box diagram'' of a list structure can
be drawn using the following recursive algorithm:
- If the item to be drawn is a symbol, write its name.
- If the item to be drawn is a list of n elements,
- Draw a horizontal set of n boxes.
- Chain the boxes together by their cdr halves, filling
in the last cdr with a diagonal to
represent () (the constant empty list).
- Draw a vertical arrow down from the car half of each box.
- At the end of each arrow, draw the
structure corresponding to that list
When we speak of the top level of a list, we mean the
horizontal chain of pairs shown at the top of its box diagram.