The functions pprint-fill, pprint-linear, and pprint-tabular specify particular ways of pretty printing a list to stream. Each function prints parentheses around the output if and only if colon-p is true. Each function ignores its at-sign-p argument. (Both arguments are included even though only one is needed so that these functions can be used via
~/.../ and as set-pprint-dispatch functions, as well as directly.) Each function handles abbreviation and the detection of circularity and sharing correctly, and uses write to print object when it is a non-list.
If object is a list and if the value of *print-pretty* is false, each of these functions prints object using a minimum of whitespace, as described in \secref\PrintingListsAndConses. Otherwise (if object is a list and if the value of *print-pretty* is true):
Evaluating the following with a line length of
25 produces the output shown.
Roads ELM MAIN MAPLE CENTER
Performs output to the indicated stream.
The cursor position on the indicated stream, if it can be determined.
The function pprint-tabular could be defined as follows:
(defun pprint-tabular (s list &optional (colon-p t) at-sign-p (tabsize nil)) (declare (ignore at-sign-p)) (when (null tabsize) (setf tabsize 16)) (pprint-logical-block (s list :prefix (if colon-p "(" "") :suffix (if colon-p ")" "")) (pprint-exit-if-list-exhausted) (loop (write (pprint-pop) :stream s) (pprint-exit-if-list-exhausted) (write-char #\Space s) (pprint-tab :section-relative 0 tabsize s) (pprint-newline :fill s))))
Note that it would have been inconvenient to specify this function using format, because of the need to pass its tabsize argument through to a
~:T format directive nested within an iteration over a list.