This package provides functions for printing tree structures.
The main entry point is the `print-tree' function. It accepts a
stream, a tree object and a printer function.
In common cases, tree printer functions can be creating using
`make-node-printer' or `make-folding-node-printer'.
Print the tree ROOT to STREAM using PRINTER.
PRINTER is called with four arguments, STREAM, ROOT, the
keyword :root and the integer 0, indicating depth zero. PRINTER
will usually call `print-node', `print-subree' and
`print-node-contents' to do the actual work.
Functions suitable for use as PRINTER can, for many common cases,
be constructed via `make-node-printer' and
Return a node printer function that used FIRST-LINE-PRINTER,
REST-PRINTER and CHILDREN.
FIRST-LINE-PRINTER is called with the destination stream, the depth
of the node and the node and should print a one-line representation
of the node to the stream. The function should return true if
REST-PRINTER should be called to print more details for the node.
REST-PRINTER is also called with the destination stream, the depth
of the node and node. It is not restricted to only producing a
single line, however.
CHILDREN is called with a node and must return a (possibly empty)
list of children of the node.
Like `make-node-printer', return a node printer function that used
FIRST-LINE-PRINTER, REST-PRINTER and CHILDREN.
PREDICATE is called to determine whether and to what extend nodes
should be printed. When called with the depth of a node and node as
its arguments, PREDICATE must return a list of "bits" of the node
that should be printed. The following bits are recognized:
Print first line of the node by calling FIRST-LINE-PRINTER?
Print more details for the node by calling REST-PRINTER?
Print children of the node?
Print ellipsis of the form "?", if the node has children
butlast the :children bit has not been specified?
When PREDICATE returns T, all bits are printed.