~
nR
prints arg in radix n.
The modifier flags and any remaining parameters are used as for
the ~D
directive.
~D
is the same as ~10R
.
The full form is
~
radix,
mincol,
padchar,
commachar,
comma-intervalR
.
If no prefix parameters are given to ~R
, then a different
interpretation is given. The argument should be an integer.
For example, if arg is 4:
~R
prints arg as a cardinal English number: four
.
~:R
prints arg as an ordinal English number: fourth
.
~@R
prints arg as a Roman numeral: IV
.
~:@R
prints arg as an old Roman numeral: IIII
.
For example:
(format nil "~,,' ,4:B" 13) → "1101" (format nil "~,,' ,4:B" 17) → "1 0001" (format nil "~19,0,' ,4:B" 3333) → "0000 1101 0000 0101" (format nil "~3,,,' ,2:R" 17) → "1 22" (format nil "~,,'|,2:D" #xFFFF) → "6|55|35"
If and only if the first parameter, n, is supplied,
~R
binds
*print-escape*
to false,
*print-radix*
to false,
*print-base*
to n,
and *print-readably*
to false.
If and only if no parameters are supplied,
~R
binds *print-base*
to 10
.
An arg, which should be an integer,
is printed in decimal radix.
~D
will never put a decimal point after the number.
~
mincolD
uses
a column width of mincol; spaces are inserted on
the left if the number requires fewer than mincol columns for its digits
and sign. If the number doesn't fit in mincol columns, additional columns
are used as needed.
~
mincol,
padcharD
uses padchar as the pad character
instead of space.
If arg is not an integer, it is printed in ~A
format and decimal base.
The @
modifier causes the number's sign to be printed always; the default
is to print it only if the number is negative.
The :
modifier causes commas to be printed between groups of digits;
commachar may be used to change the character used as the comma.
comma-interval
must be an integer and defaults to 3. When the :
modifier is given to any of
these directives, the commachar
is printed between groups of comma-interval
digits.
Thus the most general form of ~D
is
~
mincol,
padchar,
commachar,
comma-intervalD
.
~D
binds
*print-escape*
to false,
*print-radix*
to false,
*print-base*
to 10
,
and *print-readably*
to false.
This is just like ~D
but prints in binary radix (radix 2)
instead of decimal. The full form is therefore
~
mincol,
padchar,
commachar,
comma-intervalB
.
~B
binds
*print-escape*
to false,
*print-radix*
to false,
*print-base*
to 2
,
and *print-readably*
to false.
This is just like ~D
but prints in octal radix (radix 8)
instead of decimal. The full form is therefore
~
mincol,
padchar,
commachar,
comma-intervalO
.
~O
binds
*print-escape*
to false,
*print-radix*
to false,
*print-base*
to 8
,
and *print-readably*
to false.
This is just like ~D
but prints in hexadecimal radix
(radix 16) instead of decimal. The full form is therefore
~
mincol,
padchar,
commachar,
comma-intervalX
.
~X
binds
*print-escape*
to false,
*print-radix*
to false,
*print-base*
to 16
,
and *print-readably*
to false.