Output
write object [&key*] ⇒ object
write-byte integer binary-output-stream
write-char character [output-stream] ⇒ character
write-string string [output-stream] &key :start :end ⇒ string
write-line string [output-stream] &key :start :end ⇒ string
write-sequence
terpri [output-stream] ⇒ nil
fresh-line [output-stream] ⇒ boolean
finish-output [output-stream] ⇒ nil
force-output [output-stream] ⇒ nil
clear-output [output-stream] ⇒ nil
with-output-to-string
write-to-string object [&key*] ⇒ object
prin1-to-string object ⇒ object
princ-to-string object ⇒ object
prin1 object [output-stream] ⇒ object
produces output suitable for input to read.
print object [output-stream] ⇒ object
like prin1 except that the printed representation of object is preceded by a newline and followed by a space.
pprint object [output-stream] ⇒ object
just like print except that the trailing space is omitted and object is printed with the print-pretty flag non-nil to produce pretty output.
princ object [output-stream] ⇒ object
is just like prin1 except that the output has no escape characters. The general rule is that output from princ is intended to look good to people, while output from prin1 is intended to be acceptable to read.
print-unreadable-object (object stream &key type identity) form* ⇒ nil
*print-readably*
Format
format destination control-string args* ⇒ result
Creates formatted output using the control-string and observing tilde indicated directives. If destination is a string, a stream, or t, then the result is nil. Otherwise, the result is a string containing the formatted output.
(format nil "Hello, ~a" 'lisp) ;⇒ "Hello, LISP!"
Basic Directives:
~A
—Aesthetic. Print without escape characters (princ).~S
—Standard. Print with escape characters (prin1).~%
—Newline character.~n%
outputs n newlines.
Number Directives:
~D
—Decimal.~B
—Binary. Prints radix 2.~O
—Octal. Prints radix 8.~X
—Hexadecimal. Prints radix 16.~R
—Radix.~nR
prints in radix n.~F
—Float.~width,count,scale,overflowchar,padcharF
~E
—Exponential notation.~width,count,scale,overflowchar,padchar,exptcharE.
~G
—General floating-point.~width,count,scale,overflowchar,padchar,exptcharG.
~$
—Dollars.~count,min-count,min-width,padchar$
The @
modifer causes the sign to always print. :
adds commas between groups of digits. The most general form of ~D
is ~mincol,padchar,commachar,comma-intervalD.
Formatting Directives:
~W
—Write. Obey every printer-control variable (write).~C
—Character.~~
—Escape tilde character.~&
—Fresh line.~<newline>
—Ignores the newline and any whitespace that follows.~_
—Conditional newline.~|
—Page separator character.~T
—Tabulate.~I
—Indent.
Control Directives:
~:>
—Logical Block.~/
—Call function.~<
—Justification.~>
—End justifcation.~*
—Go-To.~[
—Conditional expression.~]
—End conditional expression.~{
—Iteration.~}
—End iteration.~?
—Recursive processing.~(
—Case conversion.~)
—End case conversion.~P
—Plural.~;
—Clause separator.~^
—Escape upward.