Format directives
Describes the general syntax of format directive invocations,
then details the syntax and semantics of each format directive.
(Well, not actually the case for now.)
This section is incomplete, unlike the CLHS summary table.
(All FORMAT directives are mentioned, but in quite insufficient depth.)
Floating Point
⚓
Within a FORMAT string, each FORMAT directive invocation is introduced by a literal tilde ("~") and followed by prefix arguments (if any), modifiers (if any) and finally the command name.
Field name | Prefix arguments | Modifiers | Command name | |
---|---|---|---|---|
Acceptable input | ~ | Comma-separated arguments | : and/or @ or nothing | One case-insensitive letter |
⚓
("Special selection mechanism" is not a formal term, I just made it up for the purposes of this article.)
TODO
⚓
Arguments
Prefix | Modifiers (select) | Consumed | |
---|---|---|---|
∅ | ∅ | write-char (if simple character) |
|
: | Pretty | ||
@ | Escape | ||
:@ | Modifiers |
Bound printer variables
if @ (only) | *print-escape* |
---|---|
t |
⚓
Arguments
Prefix | Modifiers | Consumed |
---|---|---|
|
∅ | ∅ |
⚓
Arguments
Prefix | Modifiers | Consumed |
---|---|---|
|
∅ | ∅ |
⚓
Arguments
Prefix | Modifiers | Consumed |
---|---|---|
|
∅ | ∅ |
⚓
Arguments
Prefix | Modifiers | Consumed |
---|---|---|
|
∅ | ∅ |
⚓
The ~R
format directive supports two quite different sets of functionality depending on if any prefix arguments are supplied to it or not. This selection mechanism is unique to ~R
.
⚓
Arguments
Prefix | Modifiers (select) | Consumed | |
---|---|---|---|
∅ | ∅ | Cardinal |
|
: | Ordinal | ||
@ | Roman | ||
:@ | Old roman |
Bound printer variables
*print-base* |
---|
10 |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
|
: | Commas |
|
@ | Sign |
Bound printer variables
*print-escape* | *print-radix* | *print-base* | *print-readably* |
---|---|---|---|
false | false | radix | false |
⚓
Arguments
Same as ~R with prefix args,
but without the initial radix prefix argument.
Bound printer variables
Same as ~R with prefix args.
*print-base* is bound to the corresponding radix indicated in the table below.
These format directives are merely convenient aliases for invoking the ~R
format directive with a specific radix argument, followed by any prefix arguments and modifiers given to the alias, which are forwarded directly to ~R
.
⚓
To be written.
⚓
Arguments
Prefix | Modifiers | Consumed | |
---|---|---|---|
|
@ | Sign |
|
Bound printer variables
*print-escape* | *print-readably* |
---|---|
false | false |
⚓
Arguments
Same as ~G:
Prefix | Modifiers | Consumed | |
---|---|---|---|
|
@ | Sign |
|
Bound printer variables
*print-escape* | *print-readably* |
---|---|
false | false |
⚓
Arguments
Same as ~E:
Prefix | Modifiers | Consumed | |
---|---|---|---|
|
@ | Sign |
|
Bound printer variables
*print-escape* | *print-readably* |
---|---|
false | false |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
|
: | Sign before padding |
|
@ | Sign |
Bound printer variables
*print-escape* | *print-readably* |
---|---|
false | false |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
Same as ~S and ~<~> :
|
: | Paren |
|
@ | Padleft |
Bound printer variables
*print-escape* | *print-readably* |
---|---|
false | false |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
Same as ~A and ~<~> :
|
: | Paren |
|
@ | Padleft |
Bound printer variables
*print-escape* |
---|
t |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
∅ | : | Pretty |
|
@ | Fully |
Bound printer variables
if : | *print-pretty* | |
---|---|---|
true | ||
if @ | *print-level* | *print-length* |
nil | nil |
⚓
Arguments
Prefix | Modifiers (select) | Consumed | |
---|---|---|---|
∅ | ∅ | Linear | ∅ |
: | Fill | ||
@ | Miser | ||
:@ | Mandatory |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
∅ | : | Paren |
|
@ | &rest |
⚓
Arguments
Prefix | Modifiers (select) | Consumed | |
---|---|---|---|
|
∅ | :block | ∅ |
: | :current |
⚓
Arguments
All prefix arguments and modifiers
along with one consumed argument
are forwarded to the function.
⚓
Arguments
Prefix | Modifiers (select) | Consumed | |
---|---|---|---|
|
∅ | :line | ∅ |
: | :section | ||
@ | :line-relative | ||
:@ | :section-relative |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
Same as ~A and ~S:
|
: | Padleft |
|
@ | Padright |
⚓
Arguments
Prefix | Modifiers (select) | Consumed | |
---|---|---|---|
|
∅ | Forward | ! |
: | Back | ||
@ | Absolute |
⚓
⚓
Arguments
Prefix | Modifiers | Consumed | |
---|---|---|---|
|
: | ✘ |
|
@ | ✘ |
⚓
Arguments
Prefix | Modifiers | Consumed | |
---|---|---|---|
∅ | : | ✔ |
|
@ | ✘ |
⚓
Arguments
Prefix | Modifiers | Consumed | |
---|---|---|---|
∅ | : | ✔ |
|
@ | ✔ |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
|
: | Sublists |
|
@ | &rest |
⚓
Arguments
Prefix | Modifier | Consumed | |
---|---|---|---|
∅ | @ | &rest |
|
⚓
Arguments
Prefix | Modifiers (select) | Consumed | |
---|---|---|---|
∅ | ∅ | string-downcase |
args consumed by interior |
: | string-capitalize | ||
@ | Capitalize downcase | ||
:@ | string-upcase |
⚓
Arguments
Prefix | Modifiers (Combine) | Consumed | |
---|---|---|---|
∅ | : | Previous |
|
@ | "...ies" |