Common Lisp Format Control Strings
Overview of the Common Lisp format function’s control strings. Mostly taken from the Common Lisp HyperSpec, reduced to the examples.
Basic Output
~c Character
~% Newline
~& Fresh-Line
Outputs a newline if the output stream is not at the beginning of a line. ~n& produces ~&~(n-1)%.
~| Page
~~ Tilde
Radix Control
~r Radix
~nr prints arg in radix n. The modifier flags and any remaining parameters are used as for the ~d directive. The full form is ~radix,mincol,padchar,commachar,comma-intervalr. If no prefix arguments are given, the argument should be an integer and is printed as an English word or Roman numeral.
~d Decimal
The most general form of ~d is ~mincol,padchar,commachar,comma-intervald. If arg is not an integer, it is printed in ~a format and decimal base.
~b Binary
Just like ~d but prints in radix 2.
~o Octal
Just like ~d but prints in radix 8.
~x Hexadecimal
Just like ~d but prints in radix 16.
Also see this FORMAT summary table.
document, programming tips