Drawing Box Diagrams of List Structure

A ``box diagram'' of a list structure can be drawn using the following recursive algorithm:

  1. If the item to be drawn is a symbol, write its name.

  2. If the item to be drawn is a list of n elements,
    1. Draw a horizontal set of n boxes.

    2. Chain the boxes together by their cdr halves, filling in the last cdr with a diagonal to represent () (the constant empty list).

    3. Draw a vertical arrow down from the car half of each box.

    4. At the end of each arrow, draw the structure corresponding to that list element.

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.

Contents    Page-10    Prev    Next    Page+10    Index