This page was last updated on .

The table is fairly complete and detailed, for a summary.

FORMAT reference » CLHS summary » 22.3 Formatted Output (Introduction)

It's hard to produce a "value-added" summary for this section (excluding subsections).
You should probably just read it, it's fairly short and informative.

Some particular features that not everyone may know is that you can use V (dynamic argument) or # (number of parameters remaining) as a prefix parameter.

FORMAT reference » CLHS summary » 22.3.1 to 22.3.9 (Directive definitions)

The following table is already fairly complete and detailed, for a summary. One notable todo would be to dynamically show some examples and other information such as bound printer variables (as appropriate) on the left when hovering over the cells of the table.

The first column ("~") links to the "full reference" part of this article (on another page), which for now is lacking quite a bit of depth.

Note that the following table is not intended to be "standalone". You'll need to complete with other sources of information such as the CLHS and practice a lot to make sense of it.
Most of this table's (insane) complexity directly reflects the accidental (due to packing a complex language into a string) yet unavoidable (you can't ignore it) complexity of FORMAT itself.
If you hate this table, then you hate FORMAT. (This isn't idle ranting either, I'm writing this article as a stepping stone to writing my own lispy FORMAT replacement. See a complex example.)

(This table has been called a monument to my sins. I have developed a certain fondness for that assertion.)

~ Name Function Prefix args Colon At-sign Consume
CLHS 22.3.1 FORMAT Basic Output
~C Character write-char write-char
(if simple character)
  1. character
Pretty Escape
Modifiers
~% Newline terpri # of newlines
~& Fresh-Line fresh-line # of fresh lines
~| Page # of pages
~~ Tilde # of tildes
CLHS 22.3.2 FORMAT Radix Control
~R Radix Without args Cardinal
  1. integer
Ordinal Roman
Old roman
write (:base) Radix, ~D args Commas Sign
  1. integer
    (or any object)
~D Decimal
  1. mincol
  2. padchar
  3. comma-char
  4. comma-interval
~B Binary
~O Octal
~X Hexadecimal
CLHS 22.3.3 FORMAT Floating-Point Printers
~F Fixed-Format
Floating Point
  1. width
  2. decimals
  3. scale
  4. overflow
  5. pad
Sign
  1. float
    (or a rational,
    or any object)
~E Exponential
Floating Point
  1. width
  2. decimals
  3. exponent-width
  4. scale
  5. overflow
  6. pad
  7. exponent-char
~G General
Floating Point
~$ Monetary
Floating Point
  1. decimals
  2. min-units
  3. min-width
  4. padchar
Sign
before
padding
Sign
CLHS 22.3.4 FORMAT Printer Operations
~A Aesthetic princ
  1. mincol
  2. colinc
  3. minpad
  4. padchar
Parentheses Padleft object
~S Standard prin1
~W Write write Pretty Fully
CLHS 22.3.5 FORMAT Pretty Printer Operations
~_ Conditional
Newline
pprint-newline :linear 0
:fill :miser
:mandatory
~< Logical
Block
pprint-logical-
block
Parentheses &rest object
~;
  1. Prefix (Optional. No "~".)
  2. Body (↺)
  3. Suffix (Optional. No "~".)
~@; First clause Per-line prefix
~^ pprint-exit-
if-list-
exhausted
~^ prefix args
~:> Fill
~I Indent pprint-indent
  1. n
:block
:current
~/ Call Function [Forwarded] object
CLHS 22.3.6 FORMAT Layout Control
~T Tabulate pprint-tab
  1. colnum
  2. colinc
:line
:section :line-relative
:section-relative
~< Justification

Like ~A
(tip: hover)

Padleft Padright
~;

Spacing is evenly divided
between segments (clauses).

~:; First segment
  1. n
  2. line-width

(See prose.)

~^ ~^ prefix args

Only the completely processed
clauses are justified.

~>
CLHS 22.3.7 FORMAT Control Flow Operations
~* Go-To
  1. n
Forward !
Back Absolute
~[ Conditional
Expression
case
  1. index
    (zero-based)
  1. index
(Unless prefix)
~;

indexth clause will be executed.

~:; Last segment Default clause
~]
~:[ if (approx)
  1. generalized-
    boolean
~;
  1. alternative ("else")
  2. consequent ("then")
~]
~@[ when (approx)
  1. generalized-
    boolean

    (not consumed
    if true)
  1. consequent ("then")
    (Should consume one arg.)
~]
~{ Iteration
  1. max-reps
Sublists &rest list

Recursive call to format.

Empty interior:
control-string
(before list)

~^ ~^ prefix args

Finish entire
iteration

(If sublists)

If using ~@{,
only consume
processed args.

~} >0 iterations
(unless 0 max-reps)
~? Recursive
Processing
format
  1.  
  2. &rest
  1. control-string
  2. args
CLHS 22.3.8 FORMAT Miscellaneous Operations
~(
~)
Case
Conversion
string-downcase

args consumed
by interior

string-capitalize Capitalize
downcase
string-upcase
~P Plural Previous "…ies"
  1. quantity (unless :)
CLHS 22.3.9 FORMAT Misc Pseudo-Operations
~; Clause
Separator

See individual instances for
~<~:>, ~<~>, ~[~], ~:[~].

~^ Escape
Upward
# prefix args Terminate if

Finish entire
iteration

Usable only with
~:{~} or ~:@{~}

0 No args remain
1 (zerop a)
2 (= a b)
3 (<= a b c)
~␤ Ignored
Newline
Ignore newline
and whitespace
Ignore
newline
Ignore
whitespace

FORMAT reference » CLHS summary » 22.3.10 Additional Information [...]

FORMAT reference » CLHS summary » 22.3.10 » Nesting of FORMAT operations

Format directive invocations must be properly nested.

FORMAT reference » CLHS summary » 22.3.10 » Missing and Additional FORMAT Args

Entire section: The consequences are undefined if no arg remains for a directive requiring an argument. However, it is permissible for one or more args to remain unprocessed by a directive; such args are ignored.

FORMAT reference » CLHS summary » 22.3.10 » Additional FORMAT Parameters

Entire section: The consequences are undefined if a format directive is given more parameters than it is described here as accepting.

(Here, "parameters" means "prefix arguments".)

FORMAT reference » CLHS summary » 22.3.10 » Undefined FORMAT modifier combinations

Entire section: The consequences are undefined if colon or at-sign modifiers are given to a directive in a combination not specifically described here as being meaningful.

FORMAT reference » CLHS summary » 22.3.11 Examples of FORMAT

What it says on the tin.

FORMAT reference » CLHS summary » 22.3.12 Notes about FORMAT

It's a short section.