0
votes

Can the common-lisp pretty printer be easily configured to print out any deeply nested list in "outline" form, or is this a job for format? Eg, '(a (b c (d e (f)) g)) should come out looking something like the following, where each cdr element steps down a level from the car:

A
 B
 C
  D
  E
   F
 G
1
Do you care about parentheses? Using PPRINT withink a narrow column will usually do something very close to this.Joshua Taylor
Yes, setting print-right-margin to 2 works. Thanks. However, it would still be interesting to know how to do this with format--mainly, how to include a variable number of tabs in the control string, as in ~nI (indent n blocks).davypough

1 Answers

1
votes

Look at the ~nT format directive. This will print the next argument at the n-th column:

(format t "~30T~a" 'a)
                              A

If the column is variable, then use ~vt to use the first argument as the column value:

(format t "~VT~a" 10 'a)
          A

This will print 'A' at the 10-th column