Next: , Up: Formatted Output


22.3.1 FORMAT Basic Output

22.3.1.1 Tilde C: Character

The next arg should be a character; it is printed according to the modifier flags.

~C prints the character as if by using write-char if it is a simple character. Characters that are not simple are not necessarily printed as if by write-char, but are displayed in an implementation-defined, abbreviated format. For example,

 (format nil "~C" #\A)  "A"
 (format nil "~C" #\Space)  " "

~:C is the same as ~C for printing characters, but other characters are “spelled out.” The intent is that this is a “pretty” format for printing characters. For simple characters that are not printing, what is spelled out is the name of the character (see char-name). For characters that are not simple and not printing, what is spelled out is implementation-defined. For example,

 (format nil "~:C" #\A)  "A"
 (format nil "~:C" #\Space)  "Space"
;; This next example assumes an implementation-defined "Control" attribute.
 (format nil "~:C" #\Control-Space)
 "Control-Space"
or "c-Space"

~:@C prints what ~:C would, and then if the character requires unusual shift keys on the keyboard to type it, this fact is mentioned. For example,

 (format nil "~:@C" #\Control-Partial)  "Control-∂ (Top-F)"

This is the format used for telling the user about a key he is expected to type, in prompts, for instance. The precise output may depend not only on the implementation, but on the particular I/O devices in use.

~@C prints the character in a way that the Lisp reader can understand, using #\ syntax.

~@C binds *print-escape* to t.

22.3.1.2 Tilde Percent: Newline

This outputs a #\Newline character, thereby terminating the current output line and beginning a new one. ~n% outputs n newlines. No arg is used.

22.3.1.3 Tilde Ampersand: Fresh-Line

Unless it can be determined that the output stream is already at the beginning of a line, this outputs a newline. ~n& calls fresh-line and then outputs n− 1 newlines. ~0& does nothing.

22.3.1.4 Tilde Vertical-Bar: Page

This outputs a page separator character, if possible. ~n| does this n times.

22.3.1.5 Tilde Tilde: Tilde

This outputs a tilde. ~n~ outputs n tildes.