1 % Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Bert Burgemeister
3 % Permission is granted to copy, distribute and/or modify this
4 % document under the terms of the GNU Free Documentation License,
5 % Version 1.2; with no Invariant Sections, no Front-Cover Texts and
6 % no Back-Cover Texts. For details see file COPYING.
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10 \section{Input/Output
}
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 \subsection{Predicates
}
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19 \IT{\arrGOO{(
\FU*
{STREAMP
} \VAR{ foo
})\\
20 (
\FU*
{PATHNAMEP
} \VAR{ foo
})\\
21 (
\FU*
{READTABLEP
} \VAR{ foo
})
}{.
}}
23 \retval{\T} if
\VAR{foo
} is of indicated type.
26 \IT{\arrGOO{(
\FU*
{INPUT-STREAM-P
} \VAR{ stream
})\\
27 (
\FU*
{OUTPUT-STREAM-P
} \VAR{ stream
})\\
28 (
\FU*
{INTERACTIVE-STREAM-P
} \VAR{ stream
})\\
29 (
\FU*
{OPEN-STREAM-P
} \VAR{ stream
})
}{.
}}
31 Return
\retval{\T} if
\VAR{stream
} is for input, for output,
32 interactive, or open, respectively.
35 \IT{(
\FU*
{PATHNAME-MATCH-P
} \VAR{path
} \VAR{wildcard
})
}
37 \retval{\T} if
\VAR{path
} matches
\VAR{wildcard
}.
40 \IT{(
\FU*
{WILD-PATHNAME-P
} \VAR{path
}
41 \OP{\Goo{\kwd{:host
}\XOR
46 \kwd{:version
}\XOR\NIL}})
}
48 Return
\retval{\T} if indicated component in
\VAR{path
} is
49 wildcard. (
\NIL\ indicates any component.)
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 \IT{(
\xorGOO{\FU*
{Y-OR-N-P
}\\
62 \FU*
{YES-OR-NO-P
}}{\
}} \Op{\VAR{control
} \OPn{\VAR{arg
}}})
}
64 Ask user a question and return
\retval{\T} or
\retval{\NIL}
65 depending on their answer. See page
\pageref{section:Format
},
66 \FU{format
}, for
\VAR{control
} and
\VAR{arg
}s.
69 \IT{(
\MC*
{WITH-STANDARD-IO-SYNTAX
} \PROGN{\VAR{form
}})
}
71 Evaluate
\VAR{form
}s with standard behaviour of reader and
72 printer. Return
\retval{values of
\VAR{form
}s
}.
75 \IT{(
\xorGOO{\FU*
{READ
}\\
76 \FU*
{READ-PRESERVING-WHITESPACE
}}{\
}}
77 \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-input
\A}} % standard-input not explicitly in standard
78 \OP{\VAR{eof-err
}\DF{\T}
79 \Op{\VAR{eof-val
}\DF{\NIL} \Op{\VAR{recursive
}\DF{\NIL}}}}})
}
81 Read printed representation of
\retval{object
}.
84 \IT{(
\FU*
{READ-FROM-STRING
} \VAR{string
}
85 \OP{\VAR{eof-error
}\DF{\T}
86 \OP{\VAR{eof-val
}\DF{\NIL}
88 \kwd{:start
}\VAR{ start
}\DF{\LIT{0}}\\
89 \kwd{:end
}\VAR{ end
}\DF{\NIL}\\
90 \kwd{:preserve-whitespace
}\VAR{ bool
}\DF{\NIL}}{\
}}}}})
}
92 Return
\retval{object
} read from string and zero-indexed
\retvalii{position
} of
96 \IT{(
\FU*
{READ-DELIMITED-LIST
} \VAR{char
}
97 \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-input
\A}}
98 \Op{\VAR{recursive
}\DF{\NIL}}})
}
100 Continue reading until encountering
\VAR{char
}. Return
\retval{list
}
101 of objects read. Signal error if no
\VAR{char
} is found in stream.
104 \IT{(
\FU*
{READ-CHAR
} \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-input
\A}}
105 \OP{\VAR{eof-err
}\DF{\T} \Op{\VAR{eof-val
}\DF{\NIL}
106 \Op{\VAR{recursive
}\DF{\NIL}}}}})
}
108 Return
\retval{next character
} from
\VAR{stream
}.
111 \IT{(
\FU*
{READ-CHAR-NO-HANG
}
112 \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-input
\A}}
113 \OP{\VAR{eof-error
}\DF{\T} \Op{\VAR{eof-val
}\DF{\NIL}
114 \Op{\VAR{recursive
}\DF{\NIL}}}}})
}
116 \retval{Next character
} from
\VAR{stream
} or
\retval{\NIL} if none
121 \OP{\VAR{mode
}\DF{\NIL} \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-input
\A}}
122 \OP{\VAR{eof-error
}\DF{\T} \Op{\VAR{eof-val
}\DF{\NIL}
123 \Op{\VAR{recursive
}\DF{\NIL}}}}}})
}
125 Next, or if
\VAR{mode
} is
\T, next non-whitespace
126 \retval{character
}, or if
\VAR{mode
} is a character,
\retval{next instance
}
127 of it, from
\VAR{stream
} without removing it there.
130 \IT{(
\FU*
{UNREAD-CHAR
} \VAR{character
}
131 \Op{\DES{\VAR{stream
}}\DF{\V{\A standard-input
\A}}})
}
133 Put last
\FU{read-char
}ed
\VAR{character
} back into
\VAR{stream
}; return
137 \IT{(
\FU*
{READ-BYTE
} \DES{\VAR{stream
}} \OP{\VAR{eof-err
}\DF{\T}
138 \Op{\VAR{eof-val
}\DF{\NIL}}})
}
140 Read
\retval{next byte
} from binary
\VAR{stream
}.
143 \IT{(
\FU*
{READ-LINE
} \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-input
\A}}
144 \OP{\VAR{eof-err
}\DF{\T} \Op{\VAR{eof-val
}\DF{\NIL}
145 \Op{\VAR{recursive
}\DF{\NIL}}}}})
}
147 Return a
\retval{line of text
} from
\VAR{stream
} and
148 \retvalii{\T} if line has been ended by end of file.
151 \IT{(
\FU*
{READ-SEQUENCE
} \DES{\VAR{sequence
}} \DES{\VAR{stream
}}
152 \Op{\kwd{:start
} \VAR{start
}\DF{\LIT{0}}}\Op{\kwd{:end
}
153 \VAR{end
}\DF{\NIL}})
}
155 Replace elements of
\VAR{sequence
} between
\VAR{start
} and
\VAR{end
}
156 with elements from binary or character
\VAR{stream
}. Return
157 \retval{index
} of
\VAR{sequence
}'s first unmodified element.
160 \IT{(
\FU*
{READTABLE-CASE
} \VAR{readtable
})
\DF{\kwd{:upcase
}}}
162 \retval{Case sensitivity attribute
} (one of
\kwd{:upcase
},
163 \kwd{:downcase
},
\kwd{:preserve
},
\kwd{:invert
}) of
164 \VAR{readtable
}.
\kwd{setf
}able.
167 \IT{(
\FU*
{COPY-READTABLE
} \OP{\VAR{from-readtable
}\DF{\V{\A readtable
\A}}
168 \Op{\DES{\VAR{to-readtable
}}\DF{\NIL}}})
}
170 Return
\retval{copy of
\VAR{from-readtable
}}.
173 \IT{(
\FU*
{SET-SYNTAX-FROM-CHAR
} \VAR{to-char
} \VAR{from-char
}
174 \OP{\DES{\VAR{to-readtable
}}\DF{\V{\A readtable
\A}}
175 \Op{\VAR{from-readtable
}\DF{standard readtable
}}})
}
177 Copy syntax of
\VAR{from-char
} to
\VAR{to-readtable
}. Return
\retval{\T}.
180 \IT{\V{\A readtable
\A}}
181 {\index{*READTABLE*@
\A READTABLE
\A}
185 \IT{\V{\A read-base
\A}\DF{\LIT{10}}}
186 {\index{*READ-BASE*@
\A READ-BASE
\A}
187 Radix for reading
\kwd{integer
}s and
\kwd{ratio
}s.
190 \IT{\V{\A read-default-float-format
\A}\DF{\kwd{single-float
}}}
191 {\index{*READ-DEFAULT-FLOAT-FORMAT*@
\A READ-DEFAULT-FLOAT-FORMAT
\A}
192 Floating point format to use when not indicated in the number read.
195 \IT{\V{\A read-suppress
\A}\DF{\NIL}}
196 {\index{*READ-SUPPRESS*@
\A READ-SUPPRESS
\A}
197 If
\T, reader is syntactically more tolerant.
200 \IT{(
\FU*
{SET-MACRO-CHARACTER
} \VAR{char
} \VAR{function
}
201 \OP{\VAR{non-term-p
}\DF{\NIL}
202 \Op{\DES{\VAR{rt
}}\DF{\V{\A readtable
\A}}}})
}
204 Make
\VAR{char
} a macro character associated with
205 \VAR{function
} of stream and
\VAR{char
}. Return
\retval{\T}.
208 \IT{(
\FU*
{GET-MACRO-CHARACTER
} \VAR{char
}
209 \Op{\VAR{rt
}\DF{\V{\A readtable
\A}}})
}
211 \retval{Reader macro function
} associated with
\VAR{char
}, and
212 \retvalii{\T} if
\VAR{char
} is a non-terminating macro character.
215 \IT{(
\FU*
{MAKE-DISPATCH-MACRO-CHARACTER
} \VAR{char
}
216 \OP{\VAR{non-term-p
}\DF{\NIL}
217 \Op{\VAR{rt
}\DF{\V{\A readtable
\A}}}})
}
219 Make
\VAR{char
} a dispatching macro character. Return
\retval{\T}.
222 \IT{(
\FU*
{SET-DISPATCH-MACRO-CHARACTER
} \VAR{char
} \VAR{sub-char
}
224 \Op{\DES{\VAR{rt
}}\DF{\V{\A readtable
\A}}})
}
226 Make
\VAR{function
} of stream,
\VAR{n
},
\VAR{sub-char
} a dispatch
227 function of
\VAR{char
} followed by
\VAR{n
}, followed by
228 \VAR{sub-char
}. Return
\retval{\T}.
231 \IT{(
\FU*
{GET-DISPATCH-MACRO-CHARACTER
} \VAR{char
} \VAR{sub-char
}
232 \Op{\VAR{rt
}\DF{\V{\A readtable
\A}}})
}
234 \retval{Dispatch function
} associated with
\VAR{char
} followed by
240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
241 \subsection{Character Syntax
}
242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
247 \KWD{\#
\boldmath$|$
}\OPn{\VAR{multi-line-comment
}}\KWD{ \boldmath$|$\#
}\\
248 \KWD*
{;
}\OPn{\VAR{one-line-comment
}}}{.
}}
249 {\index{\#
{$"|$
} {$"|$
}\#
}
250 Comments. There are stylistic conventions:
253 \IT{\KWD{;;;;
} \VAR{title
}\qquad\qquad}
254 {Short title for a block of code.
}
256 \IT{\KWD{;;;
} \VAR{intro
}\qquad\qquad}
257 {Description before a block of code.
}
259 \IT{\KWD{;;
} \VAR{state
}\qquad\qquad}
260 {State of program or of following code.
}
263 \KWD{;
}\VAR{explanation
}\\
264 \KWD{;
}\VAR{ continuation
}}{.
}}
265 {Regarding line on which it appears.
}
269 \IT{\KWD*
{(
}\OPn{\VAR{foo
}}\Op{ \KWD*
{.
} \VAR{bar
}\DF{\NIL}}\KWD*
{)
}}
271 List of
\VAR{foo
}s with the terminating cdr
\VAR{bar
}.
274 \IT{\KWD{"
}\qquad\qquad}
276 Begin and end of a string.
279 \IT{\KWD*
{'
}\VAR{foo
}\quad\qquad}
281 (
\SO*
{quote
} \VAR{foo
});
\VAR{foo
} unevaluated.
284 \IT{\KWD{\char18}(
\Op{\VAR{foo
}} \Op{\KWD*
{,
}\VAR{bar
}} \Op{\KWD{,@
}\VAR{baz
}}
285 \Op{\KWD*
{,.
}\DES{\VAR{quux
}}} \Op{\VAR{bing
}})
}
286 {\index{,"@
}\index{`@
\char18}
287 Backquote.
\SO{quote
} \VAR{foo
} and
\VAR{bing
}; evaluate
\VAR{bar
}
288 and splice the lists
\VAR{baz
} and
\VAR{quux
} into their
289 elements. When nested, outermost commas inside the innermost
290 backquote expression belong to this backquote.
293 \IT{\KWD{\#
\boldmath{$
\backslash$
}}\VAR{c
}}
295 (
\FU*
{character
} \LIT{"
}\VAR{c
}\LIT{"
}), the character
\VAR{c
}.
297 \index{\#@\#$
\backslash$
}%
299 \IT{\KWD*
{\#b
}\VAR{n
};
\KWD*
{\#o
}\VAR{n
};
\VAR{n
}\kwd{.
};
300 \KWD*
{\#x
}\VAR{n
};
\KWD{\#
}\VAR{r
}\KWD{R
}\VAR{n
}}
302 Integer of radix
2,
8,
10,
16, or
\VAR{r
}; $
2\le r
\le 36$.
305 \IT{\VAR{n
}\kwd*
{/
}\VAR{d
}\quad\qquad}
307 The
\kwd*
{ratio
} $
\frac{n
}{d
}$.
310 \IT{\GOO{\Op{\VAR{m
}}\kwd{.
}\VAR{n
}%
311 \OP{\Goo{\KWD{S
}\XOR\KWD{F
}\XOR\KWD{D
}\XOR\KWD{L
}\XOR\KWD{E
}}%
312 \VAR{x
}\DF{\KWD{E
}\LIT{0}}}%
314 \VAR{m
}\OP{\kwd{.
}\Op{\VAR{n
}}}%
315 \Goo{\KWD{S
}\XOR\KWD{F
}\XOR\KWD{D
}\XOR\KWD{L
}\XOR\KWD{E
}}\VAR{x
}}}
317 $m.n
\cdot10^x$ as
\kwd*
{short-float
},
\kwd*
{single-float
},
318 \kwd*
{double-float
},
\kwd*
{long-float
}, or the type from
\kwd{\A
319 read-default-float-format
\A}.
322 \IT{\KWD*
{\#C(
}\VAR{a b
}\kwd{)
}\qquad\qquad}
324 (
\FU*
{complex
} \VAR{a
} \VAR{b
}), the complex number
325 $
\VAR{a
}+
\VAR{b
}\text{i
}$.
328 \IT{\KWD*
{\#'
}\VAR{foo
}\qquad\qquad\qquad}
330 (
\SO*
{function
} \VAR{foo
}); the function named
\VAR{foo
}.
333 \IT{\KWD{\#
}\VAR{n
}\KWD{A
}\VAR{sequence
}}
335 \VAR{n
}-dimensional array.
338 \IT{\KWD{\#
}\Op{\VAR{n
}}\kwd{(
}\OPn{\VAR{foo
}}\kwd{)
}}
340 Vector of some (or
\VAR{n
})
341 \VAR{foo
}s filled with last
\VAR{foo
} if necessary.
344 \IT{\KWD{\#
}\Op{\VAR{n
}}\kwd{\A}\OPn{\VAR{b
}}}
346 Bit vector of some (or
\VAR{n
})
347 \VAR{b
}s filled with last
\VAR{b
} if necessary.
350 \IT{\KWD*
{\#S(
}\VAR{type
} \Goos{\VAR{slot
} \VAR{value
}}\kwd{)
}}
352 Structure of
\VAR{type
}.
355 \IT{\KWD*
{\#P
}\VAR{string
}\qquad\qquad}
360 \IT{\KWD*
{\#:
}\VAR{foo
}\qquad\qquad\qquad}
362 Uninterned symbol
\VAR{foo
}.
365 \IT{\KWD*
{\#.
}\VAR{form
}\qquad\qquad}
367 Read-time value of
\VAR{form
}.
370 \IT{\V{\A read-eval
\A}\DF{\T}}
371 {\index{*READ-EVAL*@
\A READ-EVAL
\A}
372 If
\NIL, a
\kwd{reader-error
} is signalled at
\kwd{\#.
}.
375 \IT{\KWD{\#
}\VAR{integer
}\kwd{=
} \VAR{foo
}\qquad}
377 Give
\VAR{foo
} the label
\VAR{integer
}.
380 \IT{\KWD{\#
}\VAR{integer
}\kwd{\#
}\qquad\qquad}
382 Object labelled
\VAR{integer
}.
385 \IT{\KWD{\#
\boldmath$<$
}\qquad\qquad\qquad}
387 Have the reader signal
\kwd{reader-error
}.
390 \IT{\arrGOO{\KWD*
{\#+
}\VAR{feature
} \VAR{when-feature
}\\
391 \KWD*
{\#--
}\VAR{feature
} \VAR{unless-feature
}}{.
}}
393 Means
\VAR{when-feature
} if
\VAR{feature
} is
\T; means
394 \VAR{unless-feature
} if
\VAR{feature
} is
\NIL.
\VAR{feature
} is a
395 symbol from
\V{\A features
\A}, or (
\Goo{\kwd*
{AND
}\XOR\kwd*
{OR
}}
396 \OPn{\VAR{feature
}}), or (
\kwd*
{NOT
} \VAR{feature
}).
399 \IT{\V{\A features
\A}}
400 {\index{*FEATURES*@
\A FEATURES
\A}
401 List of symbols denoting implementation-dependent features.
404 \IT{\kwd{\boldmath$|$
}\OPn{\VAR{c
}}\kwd{\boldmath$|$
};
405 \kwd{\boldmath$
\backslash$
}\VAR{c
}}
407 \index{{$"|$
} {$"|$
}}%
408 Treat arbitrary character(s)
\VAR{c
} as alphabetic preserving case.
410 \index{\@
{$
\backslash$
}}%
414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
421 \IT{(
\xorGOO{\FU*
{PRIN1
}\\
425 \VAR{foo
} \Op{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}})
}
427 Print
\VAR{foo
} to
\VAR{stream
} \FU{read
}ably,
428 \FU{read
}ably between a newline and a space,
429 \FU{read
}ably after a newline, or human-readably without any extra
430 characters, respectively.
\FU{prin1
},
\FU{print
} and
\FU{princ
}
431 return
\retval{\VAR{foo
}}.
434 \IT{\arrGOO{(
\FU*
{PRIN1-TO-STRING
} \VAR{ foo
})\\
435 (
\FU*
{PRINC-TO-STRING
} \VAR{ foo
})
}{.
}}
437 Print
\VAR{foo
} to
\retval{\VAR{string
}} \FU{read
}ably or
438 human-readably, respectively.
441 \IT{(
\GFU*
{PRINT-OBJECT
} \VAR{object
} \DES{\VAR{stream
}})
}
443 Print
\retval{\VAR{object
}} to
\VAR{stream
}. Called by the Lisp
447 \IT{(
\MC*
{PRINT-UNREADABLE-OBJECT
} (
\VAR{foo
} \DES{\VAR{stream
}}
448 \orGOO{\kwd{:type
} \VAR{bool
}\DF{\NIL}\\
449 \kwd{:identity
} \VAR{bool
}\DF{\NIL}}{\
}})
452 Enclosed in
\kwd{\#
\boldmath$<$
} and
\kwd{\boldmath$>$
}, print
453 \VAR{foo
} by means of
\VAR{form
}s to
\VAR{stream
}. Return
\retval{\NIL}.
456 \IT{(
\FU*
{TERPRI
} \Op{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}})
}
458 Output a newline to
\VAR{stream
}. Return
\retval{\NIL}.
461 \IT{(
\FU*
{FRESH-LINE
}
462 \Op{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}})
}
464 Output a newline to
\VAR{stream
} and return
\retval{\T} unless
465 \VAR{stream
} is already at the start of a line.
468 \IT{(
\FU*
{WRITE-CHAR
} \VAR{char
}
469 \Op{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}})
}
471 Output
\retval{\VAR{char
}} to
\VAR{stream
}.
474 \IT{(
\xorGOO{\FU*
{WRITE-STRING
}\\
475 \FU*
{WRITE-LINE
}}{\
}} \VAR{string
}
476 \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}
477 \OP{\orGOO{\kwd{:start
} \VAR{ start
}\DF{\LIT{0}}\\
\kwd{:end
} \VAR{
478 end
}\DF{\NIL}}{\
}}}})
}
480 Write
\retval{\VAR{string
}} to
\VAR{stream
} without/with a
484 \IT{(
\FU*
{WRITE-BYTE
} \VAR{byte
} \DES{\VAR{stream
}})
}
486 Write
\retval{\VAR{byte
}} to binary
\VAR{stream
}.
489 \IT{(
\FU*
{WRITE-SEQUENCE
} \VAR{sequence
}
490 \DES{\VAR{stream
}} \orGOO{\kwd{:start
}\VAR{ start
}\DF{\LIT{0}}\\
491 \kwd{:end
} \VAR{ end
}\DF{\NIL}}{\
}})
}
493 Write elements of
\retval{\VAR{sequence
}} to binary or character
497 \IT{(
\xorGOO{\FU*
{WRITE
}\\
498 \FU*
{WRITE-TO-STRING
}}{\
}} \VAR{foo
} \orGOO{%
499 \kwd{:array
} \VAR{ bool
}\\
500 \kwd{:base
} \VAR{ radix
}\\
501 \kwd{:case
} \xorGOO{\kwd{:upcase
}\\
503 \kwd{:capitalize
}}{.
}\\
504 \kwd{:circle
} \VAR{ bool
}\\
505 \kwd{:escape
} \VAR{ bool
}\\
506 \kwd{:gensym
} \VAR{ bool
}\\
507 \kwd{:length
} \Goo{\VAR{int
}\XOR\NIL}\\
508 \kwd{:level
} \Goo{\VAR{int
}\XOR\NIL}\\
509 \kwd{:lines
} \Goo{\VAR{int
}\XOR\NIL}\\
510 \kwd{:miser-width
} \Goo{\VAR{int
}\XOR\NIL}\\
511 \kwd{:pprint-dispatch
} \VAR{ dispatch-table
}\\
512 \kwd{:pretty
} \VAR{ bool
}\\
513 \kwd{:radix
} \VAR{ bool
}\\
514 \kwd{:readably
} \VAR{ bool
}\\
515 \kwd{:right-margin
} \Goo{\VAR{int
}\XOR\NIL}\\
516 \kwd{:stream
} \DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}%
519 Print
\VAR{foo
} to
\VAR{stream
} and return
\retval{\VAR{foo
}}, or
520 print
\VAR{foo
} into
\retval{string
}, respectively, after
521 dynamically setting printer variables corresponding to keyword
522 parameters (
\kwd{\A print-
}\VAR{bar
}\kwd{\A} becoming
523 \kwd{:
}\VAR{bar
}). (
\kwd{:stream
} keyword with
\FU{write
} only.)
527 (
\FU*
{PPRINT-FILL
} \DES{\VAR{stream
}} \VAR{ foo
}
528 \OP{\VAR{parenthesis
}\DF{\T} \text{ } \Op{\VAR{noop
}}})\\
529 (
\FU*
{PPRINT-TABULAR
} \DES{\VAR{stream
}} \VAR{ foo
}
530 \OP{\VAR{parenthesis
}\DF{\T} \text{ } \Op{\VAR{noop
} \text{ }
531 \Op{\VAR{n
}\DF{\LIT{16}}}}})\\
532 (
\FU*
{PPRINT-LINEAR
} \DES{\VAR{stream
}} \VAR{ foo
}
533 \OP{\VAR{parenthesis
}\DF{\T} \text{ } \Op{\VAR{noop
}}})\\
536 Print
\VAR{foo
} to
\VAR{stream
}. If
\VAR{foo
} is a list, print as
537 many elements per line as possible; do the same in a table with
538 a column width of
\VAR{n
} ems; or print either all elements on
539 one line or each on its own line, respectively. Return
540 \retval{\NIL}. Usable with
\FU{format
} directive
\KWD{\TLD//
}.
543 \IT{(
\MC*
{PPRINT-LOGICAL-BLOCK
} (
\DES{\VAR{stream
}} \VAR{list
}
544 \orGOO{\xorGOO{\kwd{:prefix
} \VAR{ string
}\\
545 \kwd{:per-line-prefix
} \VAR{ string
}}{\
}}\\
546 \kwd{:suffix
} \VAR{ string
}\DF{\LIT{""
}}}{\
}})
547 \OPn{(
\kwd{declare
} \OPn{\NEV{\VAR{decl
}}})
} \PROGN{\VAR{form
}})
}
549 Evaluate
\VAR{form
}s, which should print
\VAR{list
}, with
550 \VAR{stream
} locally bound to a pretty
551 printing stream which outputs to the original
\VAR{stream
}. If
552 \VAR{list
} is in fact not a list, it is printed by
553 \FU{write
}. Return
\retval{\NIL}.
558 \IT{(
\MC*
{PPRINT-POP
})
}
560 Take
\retval{next element
} off
\VAR{list
}. If there is no remaining
561 tail of
\VAR{list
}, or
\V{\A print-length
\A} or
\V{\A print-circle
\A} indicate
562 printing should end, send element together with an appropriate
563 indicator to
\VAR{stream
}.
566 \IT{(
\FU*
{PPRINT-TAB
} \xorGOO{\kwd{:line
}\\
567 \kwd{:line-relative
}\\
569 \kwd{:section-relative
}}{\
}} \VAR{c
}
570 \VAR{i
} \Op{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}})
}
572 Move cursor forward to column number $c + ki$, $k
\geq 0$ being as small
576 \IT{(
\FU*
{PPRINT-INDENT
} \xorGOO{%
578 \kwd{:current
}}{\
}} \VAR{n
}
579 \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}})
}
581 Specify indentation for innermost logical block relative to
582 leftmost position/to current position. Return
\retval{\NIL}.
585 \IT{(
\MC*
{PPRINT-EXIT-IF-LIST-EXHAUSTED
})
}
587 If
\VAR{list
} is empty, terminate logical block. Return
588 \retval{\NIL} otherwise.
593 \IT{(
\FU*
{PPRINT-NEWLINE
} \xorGOO{%
597 \kwd{:mandatory
}}{\
}}
598 \OP{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}})
}
600 Print a conditional newline if
\VAR{stream
} is a pretty printing
601 stream. Return
\retval{\NIL}.
604 \IT{\V{\A print-array
\A}}
605 {\index{*PRINT-ARRAY*@
\A PRINT-ARRAY
\A}
606 If
\T, print arrays
\FU{read
}ably.
609 \IT{\V{\A print-base
\A}\DF{\LIT{10}}}
610 {\index{*PRINT-BASE*@
\A PRINT-BASE
\A}
611 Radix for printing rationals, from
2 to
36.
614 \IT{\V{\A print-case
\A}\DF{\kwd{:upcase
}}}
615 {\index{*PRINT-CASE*@
\A PRINT-CASE
\A}
616 Print symbol names all uppercase (
\kwd{:upcase
}), all lowercase
617 (
\kwd{:downcase
}), capitalized (
\kwd{:capitalize
}).
620 \IT{\V{\A print-circle
\A}\DF{\NIL}}
621 {\index{*PRINT-CIRCLE*@
\A PRINT-CIRCLE
\A}
622 If
\T, avoid indefinite recursion while printing circular
626 \IT{\V{\A print-escape
\A}\DF{\T}}
627 {\index{*PRINT-ESCAPE*@
\A PRINT-ESCAPE
\A}
628 If
\NIL, do not print escape characters and package prefixes.
631 \IT{\V{\A print-gensym
\A}\DF{\T}}
632 {\index{*PRINT-GENSYM*@
\A PRINT-GENSYM
\A}
633 If
\T, print
\kwd{\#:
} before uninterned symbols.
636 \IT{\arrGOO{\V{\A print-length
\A}\DF{\NIL}\\
637 \V{\A print-level
\A}\DF{\NIL}\\
638 \V{\A print-lines
\A}\DF{\NIL}
640 {\index{*PRINT-LENGTH*@
\A PRINT-LENGTH
\A}\index{*PRINT-LEVEL*@
\A PRINT-LEVEL
\A}\index{*PRINT-LINES*@
\A PRINT-LINES
\A}
641 If integer, restrict printing of objects to that number of
642 elements per level/to that depth/to that number of lines.
645 \IT{\V{\A print-miser-width
\A}}
646 {\index{*PRINT-MISER-WIDTH*@
\A PRINT-MISER-WIDTH
\A}
647 If integer and greater than the width available for printing a
648 substructure, switch to the more compact miser style.
651 \IT{\V{\A print-pretty
\A}}
652 {\index{*PRINT-PRETTY*@
\A PRINT-PRETTY
\A}
653 If
\T, print prettily.
656 \IT{\V{\A print-radix
\A}\DF{\NIL}}
657 {\index{*PRINT-RADIX*@
\A PRINT-RADIX
\A}
658 If
\T, print rationals with a radix indicator.
661 \IT{\V{\A print-readably
\A}\DF{\NIL}}
662 {\index{*PRINT-READABLY*@
\A PRINT-READABLY
\A}
663 If
\T, print
\FU{read
}ably or signal error
664 \kwd{print-not-readable
}.
667 \IT{\V{\A print-right-margin
\A}\DF{\NIL}}
668 {\index{*PRINT-RIGHT-MARGIN*@
\A PRINT-RIGHT-MARGIN
\A}
669 Right margin width in ems while pretty-printing.
672 \IT{(
\FU*
{SET-PPRINT-DISPATCH
} \VAR{type
} \VAR{function
}
673 \OP{\VAR{priority
}\DF{\LIT{0}}
674 \Op{\VAR{table
}\DF{\V{\A print-pprint-dispatch
\A}}}})
}
676 Install entry comprising
\VAR{function
} of arguments stream and
677 object to print; and
\VAR{priority
} as
678 \VAR{type
} into
\VAR{table
}. If
\VAR{function
}
679 is
\NIL, remove
\VAR{type
} from
\VAR{table
}. Return
\retval{\NIL}.
682 \IT{(
\FU*
{PPRINT-DISPATCH
} \VAR{foo
}
683 \Op{\VAR{table
}\DF{\V{\A print-pprint-dispatch
\A}}})
}
685 Return highest priority
\retval{\VAR{function
}} associated with
686 type of
\VAR{foo
} and
\retvalii{\T} if there was a matching type
687 specifier in
\VAR{table
}.
690 \IT{(
\FU*
{COPY-PPRINT-DISPATCH
}
691 \Op{\VAR{table
}\DF{\V{\A print-pprint-dispatch
\A}}})
}
693 Return
\retval{copy of
\VAR{table
}} or, if
\VAR{table
} is
\NIL,
694 initial value of
\V{\A print-pprint-dispatch
\A}.
697 \IT{\V{\A print-pprint-dispatch
\A}}
698 {\index{*PRINT-PPRINT-DISPATCH*@
\A PRINT-PPRINT-DISPATCH
\A}
699 Current pretty print dispatch table.
706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
709 \label{section:Format
}
713 \IT{(
\MC*
{FORMATTER
} \NEV{\VAR{control
}})
}
715 Return
\retval{function
} of
\VAR{stream
} and
\OPn{\VAR{arg
}}
716 applying
\FU{format
} to
\VAR{stream
},
\VAR{control
}, and
717 \OPn{\VAR{arg
}} returning
\NIL\ or any excess
\VAR{arg
}s.
720 \IT{(
\FU*
{FORMAT
} \Goo{\T\XOR\NIL\XOR\VAR{out-string
}\XOR\VAR{out-stream
}}
721 \VAR{control
} \OPn{\VAR{arg
}})
}
723 Output string
\VAR{control
} which may
724 contain
\kwd{\TLD} directives possibly taking some
725 \VAR{arg
}s. Alternatively,
\VAR{control
} can be a function returned
726 by
\MC{formatter
} which is then applied to
\VAR{out-stream
} and
727 \OPn{\VAR{arg
}}. Output to
\VAR{out-string
},
\VAR{out-stream
} or,
728 if first argument is
\T, to
\V{\A standard-output
\A}. Return
729 \retval{\NIL}. If first argument is
\NIL, return
730 \retval{formatted output
}.
735 \IT{\KWD{\TLD} \Op{\VAR{min-col
}\DF{\LIT{0}}} \OP{\KWD{,
}\Op{\VAR{col-inc
}\DF{\LIT{1}}}
736 \OP{\KWD{,
}\Op{\VAR{min-pad
}\DF{\LIT{0}}}
737 \OP{\KWD{,'
}\VAR{pad-char
}\DF{\textvisiblespace}}}}
738 \KWD{\Op{:
} \Op{@
} \Goo{A
\XOR S
}}}
739 {\index{\~S@$
\sim$S
}\index{\~A@$
\sim$A
}%
740 \EM{Aesthetic/Standard.
}
741 Print argument of any type for consumption by humans/by the
742 reader, respectively. With
\kwd{:
}, print
\NIL\ as
\LIT{()
} rather
743 than
\LIT{nil
}; with
\kwd{@
}, add
\VAR{pad-char
}s on the left
744 rather than on the right.
747 \IT{\KWD{\TLD} \Op{\VAR{radix
}\DF{\LIT{10}}} \OP{\KWD{,
}\Op{\VAR{width
}}
748 \OP{\KWD{,
}\Op{\kwd{'
}\VAR{pad-char
}\DF{\textvisiblespace}}
749 \OP{\KWD{,
}\Op{\kwd{'
}\VAR{comma-char
}\DF{\LIT{,
}}}
750 \OP{\KWD{,
}\VAR{comma-interval
}\DF{\LIT{3}}}}}}
751 \KWD{\Op{:
} \Op{@
} R
}}
752 {\index{\~R@$
\sim$R
}%
754 (With one or more prefix arguments.) Print argument as number; with
755 \KWD{:
}, group digits
\VAR{comma-interval
} each; with
\kwd{@
},
756 always prepend a sign.
759 \IT{\Goo{\KWD{\TLD R
}\XOR\KWD{\TLD :R
}\XOR\KWD{\TLD
760 @R
}\XOR\KWD{\TLD @:R
}}}
763 Take argument as number and print it as English cardinal number,
764 as English ordinal number, as Roman numeral, or as old Roman
765 numeral, respectively.
768 \IT{\KWD{\TLD} \Op{\VAR{width
}}
769 \OP{\KWD{,
}\Op{\kwd{'
}\VAR{pad-char
}\DF{\textvisiblespace}}
770 \OP{\KWD{,
}\Op{\kwd{'
}\VAR{comma-char
}\DF{\LIT{,
}}}
771 \OP{\KWD{,
}\VAR{comma-interval
}\DF{\LIT{3}}}}}
772 \KWD{\Op{:
} \Op{@
} \Goo{D
\XOR B
\XOR O
\XOR X
}}}
773 {\index{\~D@$
\sim$D
}\index{\~B@$
\sim$B
}\index{\~O@$
\sim$O
}\index{\~X@$
\sim$X
}%
774 \EM{Decimal/Binary/Octal/Hexadecimal.
}
775 Print integer argument as number. With
\kwd{:
}, group digits
776 \VAR{comma-interval
} each; with
\kwd{@
}, always prepend a sign.
779 \IT{\KWD{\TLD} \Op{\VAR{width
}} \OP{\KWD{,
}\Op{\VAR{dec-digits
}}
780 \OP{\KWD{,
}\Op{\VAR{shift
}\DF{\LIT{0}}}
781 \OP{\KWD{,
}\Op{\kwd{'
}\VAR{overflow-char
}}
782 \OP{\KWD{,'
}\VAR{pad-char
}\DF{\textvisiblespace}}}}}
784 {\index{\~F@$
\sim$F
}%
785 \EM{Fixed-Format Floating-Point.
} With
786 \kwd{@
}, always pre\-pend a sign.
789 \IT{\KWD{\TLD} \Op{\VAR{width
}} \OP{\KWD{,
}\Op{\VAR{dec-digits
}}
790 \OP{\KWD{,
}\Op{\VAR{exp-digits
}}
791 \OP{\KWD{,
}\Op{\VAR{scale-factor
}\DF{\LIT{1}}}
792 \OP{\KWD{,
}\Op{\kwd{'
}\VAR{overflow-char
}}
793 \OP{\KWD{,
}\Op{\kwd{'
}\VAR{pad-char
}\DF{\textvisiblespace}}
794 \OP{\KWD{,'
}\VAR{exp-char
}}}}}}}
795 \KWD{\Op{@
} \Goo{E
\XOR G
}}}
796 {\index{\~E@$
\sim$E
}\index{\~G@$
\sim$G
}%
797 \EM{Exponential/General Floating-Point.
}
798 Print argument as floating-point number with
\VAR{dec-digits
}
799 after decimal point and
\VAR{exp-digits
} in the signed
800 exponent. With
\KWD{\TLD G
}, choose either
\KWD{\TLD E
} or
801 \KWD{\TLD F
}. With
\KWD{@
}, always prepend a sign.
804 \IT{\KWD{\TLD} \Op{\VAR{dec-digits
}\DF{\LIT{2}}}
805 \OP{\KWD{,
}\Op{\VAR{int-digits
}\DF{\LIT{1}}}
806 \OP{\KWD{,
}\Op{\VAR{width
}\DF{\LIT{0}}}
807 \OP{\KWD{,'
}\VAR{pad-char
}\DF{\textvisiblespace}}}}
808 \Op{\KWD{:
}} \Op{\kwd{@
}} \KWD{\$
}}
809 {\index{\~\$@$
\sim$\$
}%
810 \EM{Monetary Floating-Point.
}
811 Print argument as fixed-format floating-point number. With
\KWD{:
},
812 put sign before any padding; with
\KWD{@
}, always prepend a
816 \IT{\Goo{\KWD{\TLD C
}\XOR\KWD{\TLD :C
}\XOR\KWD{\TLD
817 @C
}\XOR\KWD{\TLD @:C
}}}
818 {\index{\~C@$
\sim$C
}%
820 Print, spell out, print in
\kwd{\#$
\backslash$
} syntax, or tell
821 how to type, respectively, argument as (possibly non-printing)
826 \KWD{\TLD(
} \VAR{text
} \KWD{\TLD)
}\XOR
827 \KWD{\TLD:(
} \VAR{text
} \KWD{\TLD)
}\XOR
828 \KWD{\TLD @(
} \VAR{text
} \KWD{\TLD)
}\XOR
829 \KWD{\TLD @:(
} \VAR{text
} \KWD{\TLD)
}}}
830 {\index{\~(\~)@$
\sim$( $
\sim$)
}%
831 \EM{Case-Conversion.
}
832 Convert
\VAR{text
} to lowercase, convert first letter of each word
833 to uppercase, capitalize first word and convert the rest to
834 lowercase, or convert to uppercase, respectively.
837 \IT{\Goo{\KWD{\TLD P
}\XOR\KWD{\TLD:P
}
838 \XOR\KWD{\TLD @P
}\XOR\KWD{\TLD @:P
}}}
839 {\index{\~P@$
\sim$P
}%
841 If argument
\kwd{eql
} \LIT{1} print nothing, otherwise print
\LIT{s
};
842 do the same for the previous argument; if argument
\kwd{eql
} \LIT{1}
843 print
\LIT{y
}, otherwise print
\LIT{ies
}; do the same for the
844 previous argument, respectively.
847 \IT{\KWD{\TLD} \Op{\VAR{n
}\DF{\LIT{1}}} \KWD{\%
}}
848 {\index{\~\%@$
\sim$\%
}%
850 Print
\VAR{n
} newlines.
853 \IT{\KWD{\TLD} \Op{\VAR{n
}\DF{\LIT{1}}} \KWD{\&
}}
854 {\index{\~\&@$
\sim$\&
}%
856 Print $n-
1$ newlines if output stream is at the
857 beginning of a line, or
\VAR{n
} newlines otherwise.
865 {\index{\~
\_{}@$
\sim$
\_{}}%
866 \EM{Conditional Newline.
}
867 Print a newline like
\kwd{pprint-newline
} with argument
868 \kwd{:linear
},
\kwd{:fill
},
\kwd{:miser
}, or
\kwd{:mandatory
}, respectively.
871 \IT{\Goo{\KWD{\TLD:$
\hookleftarrow$
}\XOR\KWD{\TLD@$
\hookleftarrow$
}\XOR\KWD{\TLD$
\hookleftarrow$
}}}
872 {\index{\~\~bogus-ordering
{}@$
\sim\hookleftarrow$
}%
873 \EM{Ignored Newline.
} Ignore newline, or whitespace following
874 newline, or both, respectively.
877 \IT{\KWD{\TLD} \Op{\VAR{n
}\DF{\LIT{1}}} \KWD{\boldmath$|$
}}
878 {\index{\~
\textbar@$
\sim$
{$"|$
}}%
880 Print
\VAR{n
} page separators.
883 \IT{\KWD{\TLD} \Op{\VAR{n
}\DF{\LIT{1}}} \KWD{\TLD}}
884 {\index{\~\~@$
\sim$$
\sim$
}%
886 Print
\VAR{n
} tildes.
889 \IT{\KWD{\TLD} \Op{\VAR{min-col
}\DF{\LIT{0}}}
890 \OP{\KWD{,
}\Op{\VAR{col-inc
}\DF{\LIT{1}}}
891 \OP{\KWD{,
}\Op{\VAR{min-pad
}\DF{\LIT{0}}}
892 \OP{\KWD{,'
}\VAR{pad-char
}\DF{\textvisiblespace}}}}
893 \KWD{\Op{:
} \Op{@
} \boldmath{$<$
}}
894 \OP{\VAR{nl-text
} \KWD{\TLD}\Op{\VAR{spare
}\DF{\LIT{0}} \Op{\KWD{,
}\VAR{width
}}}\kwd{:;
}}
895 \Goos{\VAR{text
} \KWD{\TLD;
}} \VAR{text
} \KWD{\TLD\boldmath{$>$
}}}
896 {\index{\~<\~>@$
\sim$$<$ $
\sim$$>$
}%
898 Justify text produced by
\VAR{text
}s in a field of at least
899 \VAR{min-col
} columns. With
\kwd{:
}, right justify; with
\kwd{@
},
900 left justify. If this would leave less than
\VAR{spare
} characters
901 on the current line, output
\VAR{nl-text
} first.
904 \IT{\KWD{\TLD} \Op{\KWD{:
}} \Op{\KWD{@
}} \KWD{\boldmath{$<$
}}
905 \GOo{\Op{\VAR{prefix
}\DF{\LIT{""
}}
906 \KWD{\TLD;
}}\XOR\Op{\VAR{per-line-prefix
}
908 \VAR{body
} \OP{\KWD{\TLD;
} \VAR{suffix
}\DF{\LIT{""
}}}
909 \KWD{\TLD:
} \Op{\KWD{@
}} \KWD{\boldmath{$>$
}}}
910 {\index{\~<\~:>@$
\sim$$<$ $
\sim$:$>$
}%
912 Act like
\kwd{pprint-logical-block
} using
\VAR{body
} as
\FU{format
}
913 control string on the elements of the list argument or, with
\KWD{@
},
914 on the remaining arguments, which are extracted by
915 \kwd{pprint-pop
}. With
\KWD{:
},
\VAR{prefix
} and
\VAR{suffix
}
916 default to
\LIT{(
} and
\LIT{)
}. When closed by
917 \KWD{\TLD @:
\boldmath{$>$
}}, spaces in
\VAR{body
} are replaced with
918 conditional newlines.
921 \IT{\Goo{\KWD{\TLD} \Op{\VAR{n
}\DF{\LIT{0}}}
922 \kwd{I
}\XOR\KWD{\TLD} \Op{\VAR{n
}\DF{\LIT{0}}} \kwd{:I
}}}
923 {\index{\~I@$
\sim$I
}%
925 Set indentation to
\VAR{n
} relative to leftmost/to current
929 \IT{\KWD{\TLD} \Op{\VAR{c
}\DF{\LIT{1}}}
930 \Op{\KWD{,
}\VAR{i
}\DF{\LIT{1}}} \Op{\KWD{:
}} \Op{\KWD{@
}} \KWD{T
}}
931 {\index{\~T@$
\sim$T
}%
933 Move cursor forward to column number $c + ki$, $k
\geq 0$ being as small
934 as possible. With
\kwd{:
}, calculate column numbers relative to
935 the immediately enclosing section. With
\kwd{@
}, move to column
936 number $c_0 + c + ki$ where $c_0$ is the current position.
940 \KWD{\TLD} \Op{\VAR{m
}\DF{\LIT{1}}} \KWD{\A}\XOR
941 \KWD{\TLD} \Op{\VAR{m
}\DF{\LIT{1}}} \KWD{:
}\KWD{\A}\XOR
942 \KWD{\TLD} \Op{\VAR{n
}\DF{\LIT{0}}} \KWD{@
}\KWD{\A}}}
943 {\index{\~*@$
\sim$
\A}%
945 Jump
\VAR{m
} arguments forward, or backward, or to argument
\VAR{n
}.
948 \IT{\KWD{\TLD} \Op{\VAR{limit
}} \Op{\KWD{{:
}}} \Op{\kwd{@
}}
949 \KWD{\boldmath{$\
{$
}} \VAR{text
} \KWD{\TLD\boldmath{$\
}$
}}}
950 {\index{\~\
{\~\
}@$
\sim$$\
{$ $
\sim\
}$
}%
952 Use
\VAR{text
} repeatedly, up to
\VAR{limit
}, as control
953 string for the elements of the list argument or (with
954 \kwd{@
}) for the remaining arguments. With
\kwd{:
} or
\kwd{@:
},
955 list elements or remaining arguments should be
956 lists of which a new one is used at each iteration step.
959 \IT{\KWD{\TLD} \OP{\VAR{x
} \OP{\kwd{,
}\VAR{y
} \Op{\kwd{,
}\VAR{z
}}}}
961 {\index{\~\^
{}@$
\sim$\^
{}}%
963 Leave immediately
\kwd{\TLD\boldmath{$<$
} \TLD\boldmath{$>$
}},
964 \kwd{\TLD\boldmath{$<$
} \TLD:
\boldmath{$>$
}},
965 \kwd{\TLD\boldmath{$\
{$
} \TLD\boldmath{$\
}$
}},
\kwd{\TLD?
}, or the
966 entire
\FU{format
} operation. With one to three prefixes, act only
967 if $x=
0$, $x=y$, or $x
\leq y
\leq z$, respectively.
970 \IT{\KWD{\TLD} \Op{\VAR{i
}} \Op{\KWD{:
}} \Op{\KWD{@
}}
971 \KWD{[} \Op{\Goos{\VAR{text
} \KWD{\TLD;
}} \VAR{text
}}
972 \Op{\kwd{\TLD:;
} \VAR{default
}} \KWD{\TLD]}}
973 {\index{\~
[\~
]@$
\sim$
[ $
\sim$
]}%
974 \EM{Conditional Expression.
}
975 Use the zero-indexed argumenth (or
976 \VAR{i
}th if given)
\VAR{text
} as a
\FU{format
} control subclause.
977 With
\kwd{:
}, use the first
\VAR{text
} if the argument value is
978 \NIL, or the second
\VAR{text
} if it is
\T. With
\kwd{@
}, do nothing
979 for an argument value of
\NIL. Use the only
\VAR{text
} and leave
980 the argument to be read again if it is
\T.
987 {\index{\~?@$
\sim$?
}%
988 \EM{Recursive Processing.
}
989 Process two arguments as control string and argument list, or
990 take one argument as control string and use then the rest of the
994 \IT{\KWD{\TLD} \OP{\VAR{prefix
} \Goos{\kwd{,
}%
996 \Op{\kwd{:
}} \Op{\kwd{@
}}
997 \KWD{/
}\OP{\VAR{package
}
998 \Op{\LIT{:
}}\LIT{:
}\DF{\LIT{cl-user:
}}}\VAR{function
}\KWD{/
}}
999 {\index{\~/ /@$
\sim$/ /
}%
1000 \EM{Call Function.
}
1001 Call all-uppercase
\VAR{package
\KWD{::
}function
} with the
1002 arguments stream, format-ar\-gu\-ment, colon-p, at-sign-p and
1003 \VAR{prefix
}es for printing format-argument.
1006 \IT{\KWD{\TLD} \Op{\KWD{:
}} \Op{\KWD{@
}} \KWD{W
}}
1007 {\index{\~W@$
\sim$W
}%
1009 Print argument of any type obeying every printer control
1010 variable. With
\kwd{:
}, pretty-print. With
\kwd{@
}, print
1011 without limits on length or depth.
1014 \IT{\Goo{\KWD{V
}\XOR\KWD{\#
}}}
1015 {\index{V
}\index{\#
}
1016 In place of the comma-separated prefix parameters: use next
1017 argument or number of remaining unprocessed arguments, respectively.
1025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1026 \subsection{Streams
}
1027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1031 \IT{(
\FU*
{OPEN
} \VAR{path
}
1032 \orGOO{\kwd{:direction
}
1033 \xorGOO{\kwd{:input
}\\
1036 \kwd{:probe
}}{\
}}\DF{\kwd{:input
}}\\
1037 \kwd{:element-type
}
1038 \xorGOO{\VAR{type
}\\
1039 \kwd{:default
}}{\
}}\DF{\kwd{character
}}\\
1041 \xorGOO{\kwd{:new-version
}\\
1044 \kwd{:rename-and-delete
}\\
1048 \NIL}{\
}}\DF{\parbox{20mm
}{%
1049 \kwd{:new-version
} if
\VAR{path
} specifies
\kwd{:newest
};\\
1051 \kwd{:if-does-not-exist
}
1052 \xorGOO{\kwd{:error
}\\
1054 \NIL}{\
}}\DF{\parbox{27mm
}{%
1055 \NIL\ for
\kwd{:direction :probe
};\\
1056 \mbox{\Goo{\kwd{:create
}\XOR\kwd{:error
}} otherwise
}}}\\
1057 \kwd{:external-format
} \VAR{format
}\DF{\kwd{:default
}}%
1060 Open
\retval{\kwd{file-stream
} to
\VAR{path
}}.
1064 (
\FU*
{MAKE-CONCATENATED-STREAM
} \OPn{\VAR{input-stream
}})\\
1065 (
\FU*
{MAKE-BROADCAST-STREAM
} \OPn{\VAR{output-stream
}})\\
1066 (
\FU*
{MAKE-TWO-WAY-STREAM
} \VAR{input-stream-part
} \VAR{output-stream-part
})\\
1067 (
\FU*
{MAKE-ECHO-STREAM
} \VAR{from-input-stream
} \VAR{to-output-stream
})\\
1068 (
\FU*
{MAKE-SYNONYM-STREAM
} \VAR{variable-bound-to-stream
})
}{.
}}
1070 Return
\retval{stream
} of indicated type.
1073 \IT{(
\FU*
{MAKE-STRING-INPUT-STREAM
} \VAR{string
}
1074 \OP{\VAR{start
}\DF{\LIT{0}}
1075 \Op{\VAR{end
}\DF{\NIL}}})
}
1077 Return a
\retval{\kwd{string-stream
}} supplying the characters from
\VAR{string
}.
1080 \IT{(
\FU*
{MAKE-STRING-OUTPUT-STREAM
} \Op{\kwd{:element-type
}
1081 \VAR{type
}\DF{\kwd{character
}}})
}
1083 Return a
\retval{\kwd{string-stream
}} accepting characters
1084 (available via
\FU{get-output-stream-string
}).
1087 \IT{\arrGOO{(
\FU*
{CONCATENATED-STREAM-STREAMS
} \VAR{concatenated-stream
})\\
1088 (
\FU*
{BROADCAST-STREAM-STREAMS
} \VAR{broadcast-stream
})
}{.
}}
1090 Return
\retval{list of streams
} \VAR{concatenated-stream
} still
1091 has to read from/
\VAR{broadcast-stream
} is
1096 (
\FU*
{TWO-WAY-STREAM-INPUT-STREAM
} \VAR{ two-way-stream
})\\
1097 (
\FU*
{TWO-WAY-STREAM-OUTPUT-STREAM
} \VAR{ two-way-stream
})\\
1098 (
\FU*
{ECHO-STREAM-INPUT-STREAM
} \VAR{ echo-stream
})\\
1099 (
\FU*
{ECHO-STREAM-OUTPUT-STREAM
} \VAR{ echo-stream
})
}{.
}}
1101 Return
\retval{source stream
} or
\retval{sink stream
} of
1102 \VAR{two-way-stream
}\slash\VAR{echo-stream
}, respectively.
1105 \IT{(
\FU*
{SYNONYM-STREAM-SYMBOL
} \VAR{synonym-stream
})
}
1107 Return
\retval{symbol
} of
\VAR{synonym-stream
}.
1110 \IT{(
\FU*
{GET-OUTPUT-STREAM-STRING
} \DES{\VAR{string-stream
}})
}
1112 Clear and return as a
\retval{string
} characters on
1113 \VAR{string-stream
}.
1116 \IT{(
\FU*
{FILE-POSITION
} \VAR{stream
} \Op{\xorGOO{\kwd{:start
}\\
1118 \VAR{position
}}{\
}}})
}
1120 Return
\retval{position within stream
}, or set it to
1121 \retval{\VAR{position
}} and return
\retval{\T} on success.
1124 \IT{(
\FU*
{FILE-STRING-LENGTH
} \VAR{stream
} \VAR{foo
})
}
1126 \retval{Length
} \VAR{foo
} would have in
\VAR{stream
}.
1129 \IT{(
\FU*
{LISTEN
} \Op{\VAR{stream
}\DF{\V{\A standard-input
\A}}})
}
1131 \retval{\T} if there is a character in input
\VAR{stream
}.
1134 \IT{(
\FU*
{CLEAR-INPUT
}
1135 \Op{\DES{\VAR{stream
}}\DF{\V{\A standard-input
\A}}})
}
1137 Clear input from
\VAR{stream
}, return
\retval{\NIL}.
1140 \IT{(
\xorGOO{\FU*
{CLEAR-OUTPUT
}\\
1141 \FU*
{FORCE-OUTPUT
}\\
1142 \FU*
{FINISH-OUTPUT
}}{\
}}
1143 \Op{\DES{\VAR{stream
}}\DF{\V{\A standard-output
\A}}})
}
1145 End output to
\VAR{stream
} and return
\retval{\NIL} immediately,
1146 after initiating flushing of buffers, or after flushing of
1147 buffers, respectively.
1150 \IT{(
\FU*
{CLOSE
} \DES{\VAR{stream
}} \Op{\kwd{:abort
}
1151 \VAR{bool
}\DF{\NIL}})
}
1153 Close
\VAR{stream
}. Return
\retval{\T} if
\VAR{stream
} had been
1154 open. If
\kwd{:abort
} is
\T, delete associated file.
1157 \IT{(
\MC*
{WITH-OPEN-FILE
} (
\VAR{stream
} \VAR{path
}
1158 \OPn{\VAR{open-arg
}})
\OPn{(
\kwd{declare
} \OPn{\NEV{\VAR{decl
}}})
}
1159 \PROGN{\VAR{form
}})
}
1161 Use
\FU{OPEN
} with
\VAR{open-arg
}s to temporarily create
1162 \VAR{stream
} to
\VAR{path
}; return
\retval{values of
1166 \IT{(
\MC*
{WITH-OPEN-STREAM
} (
\VAR{foo
} \DES{\VAR{stream
}})
1167 \OPn{(
\kwd{declare
} \OPn{\NEV{\VAR{decl
}}})
} \PROGN{\VAR{form
}})
}
1169 Evaluate
\VAR{form
}s with
\VAR{foo
} locally bound to
1170 \VAR{stream
}. Return
\retval{values of
\VAR{form
}s
}.
1173 \IT{(
\MC*
{WITH-INPUT-FROM-STRING
} (
\VAR{foo
} \VAR{string
}
1174 \orGOO{\kwd{:index
} \DES{\VAR{index
}}\\
1175 \kwd{:start
} \VAR{ start
}\DF{\LIT{0}}\\
1176 \kwd{:end
} \VAR{ end
}\DF{\NIL}}{\
}})
\OPn{(
\kwd{declare
}
1177 \OPn{\NEV{\VAR{decl
}}})
} \PROGN{\VAR{form
}})
}
1179 Evaluate
\VAR{form
}s with
\VAR{foo
} locally bound to input
1180 \kwd{string-stream
} from
\VAR{string
}. Return
\retval{values of
1181 \VAR{form
}s
}; store next reading position into
\VAR{index
}.
1184 \IT{(
\MC*
{WITH-OUTPUT-TO-STRING
} (
\VAR{foo
}
1185 \OP{\DES{\VAR{string
}}\DF{\NIL}
1186 \Op{\kwd{:element-type
}
1187 \VAR{type
}\DF{\kwd{character
}}}})
1189 \OPn{\NEV{\VAR{decl
}}})
} \PROGN{\VAR{form
}})
}
1191 Evaluate
\VAR{form
}s with
\VAR{foo
} locally bound to an output
1192 \kwd{string-stream
}. Append output to
\VAR{string
} and return
1193 \retval{values of
\VAR{form
}s
} if
\VAR{string
} is given. Return
1194 \retval{string containing output
} otherwise.
1197 \IT{(
\FU*
{STREAM-EXTERNAL-FORMAT
} \VAR{stream
})
}
1199 \retval{External file format designator
}.
1202 \IT{\V{\A terminal-io
\A}}
1203 {\index{*TERMINAL-IO*@
\A TERMINAL-IO
\A}
1204 Bidirectional stream to user terminal.
1207 \IT{\arrGOO{\V{\A standard-input
\A}\\
1208 \V{\A standard-output
\A}\\
1209 \V{\A error-output
\A}}{.
}}
1210 {\index{*STANDARD-INPUT*@
\A STANDARD-INPUT
\A}%
1211 \index{*STANDARD-OUTPUT*@
\A STANDARD-OUTPUT
\A}%
1212 \index{*ERROR-OUTPUT*@
\A ERROR-OUTPUT
\A}
1213 Standard input stream, standard output stream,
1214 or standard error output stream, respectively.
1217 \IT{\arrGOO{\V{\A debug-io
\A}\\
1218 \V{\A query-io
\A}}{.
}}
1219 {\index{*DEBUG-IO*@
\A DEBUG-IO
\A}\index{*QUERY-IO*@
\A QUERY-IO
\A}
1220 Bidirectional streams for debugging and user interaction.
1226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1227 \subsection[Paths and Files
]{Pathnames and Files
}
1228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1232 \IT{(
\FU*
{MAKE-PATHNAME
}
1233 \orGOO{\kwd{:host
} \Goo{\VAR{host
}\XOR\NIL\XOR\kwd{:unspecific
}}\\
1234 \kwd{:device
} \Goo{\VAR{device
}\XOR\NIL\XOR\kwd{:unspecific
}}\\
1235 \kwd{:directory
} \xorGOO{%
1236 \Goo{\VAR{directory
}\XOR\kwd{:wild
}\XOR\NIL\XOR\kwd{:unspecific
}}\\
1244 \kwd{:wild-inferiors
}\\
1250 \Goo{\VAR{file-name
}\XOR\kwd{:wild
}\XOR\NIL\XOR\kwd{:unspecific
}}\\
1252 \Goo{\VAR{file-type
}\XOR\kwd{:wild
}\XOR\NIL\XOR\kwd{:unspecific
}}\\
1254 \Goo{\kwd{:newest
}\XOR\VAR{version
}\XOR\kwd{:wild
}\XOR\NIL\XOR\kwd{:unspecific
}}\\
1256 \VAR{path
}\DF{host from
\V{\A default-pathname-defaults
\A}}\\
1258 \Goo{\kwd{:local
}\XOR\kwd{:common
}}\DF{\kwd{:local
}}}}{\
}})
}
1260 Construct a
\retval{logical pathname
} if there is a logical
1261 pathname translation for
\VAR{host
}, otherwise construct a
1262 \retval{physical pathname
}. For
\kwd{:case :local
}, leave case of
1263 components unchanged. For
\kwd{:case :common
}, leave mixed-case
1264 components unchanged; convert all-uppercase components into local
1265 customary case; do the opposite with all-lowercase components.
1269 (
\xorGOO{\FU*
{PATHNAME-HOST
}\\
1270 \FU*
{PATHNAME-DEVICE
}\\
1271 \FU*
{PATHNAME-DIRECTORY
}\\
1272 \FU*
{PATHNAME-NAME
}\\
1273 \FU*
{PATHNAME-TYPE
}}{\
}}
1274 \VAR{ path-or-stream
}
1275 \Op{\kwd{:case
} \xorGOO{\kwd{:local
}\\
1276 \kwd{:common
}}{\
}}\DF{\kwd{:local
}}})\\
1277 (
\FU*
{PATHNAME-VERSION
} \VAR{path-or-stream
})
}{.
}}
1279 Return
\retval{pathname component
}.
1282 \IT{(
\FU*
{PARSE-NAMESTRING
} \VAR{foo
}
1284 \OP{\VAR{default-pathname
}\DF{\V{\A default-pathname-defaults
\A}}
1285 \orGOO{\kwd{:start
} \VAR{ start
}\DF{\LIT{0}}\\
1286 \kwd{:end
} \VAR{ end
}\DF{\NIL}\\
1287 \kwd{:junk-allowed
} \VAR{ bool
}\DF{\NIL}}{\
}}}})
}
1289 Return
\retval{pathname
} converted from
1290 string, pathname, or stream
\VAR{foo
}; and
\retvalii{position
}
1291 where parsing stopped.
1294 \IT{(
\FU*
{MERGE-PATHNAMES
} \VAR{path-or-stream
}
1295 \OP{\VAR{default-path-or-stream
}\DF{\V{\A default-pathname-defaults
\A}}
1296 \Op{\VAR{default-version
}\DF{\kwd{:newest
}}}})
}
1298 Return
\retval{pathname
} made by filling in components missing in
1299 \VAR{path-or-stream
} from
\VAR{default-path-or-stream
}.
1302 \IT{\V{\A default-pathname-defaults
\A}}
1303 {\index{*DEFAULT-PATHNAME-DEFAULTS*@
\A DEFAULT-PATHNAME-DEFAULTS
\A}
1304 Pathname to use if one is needed and none supplied.
1307 \IT{(
\FU*
{USER-HOMEDIR-PATHNAME
} \Op{\VAR{host
}})
}
1309 User's
\retval{home directory
}.
1312 \IT{(
\FU*
{ENOUGH-NAMESTRING
} \VAR{path-or-stream
}
1313 \Op{\VAR{root-path
}\DF{\V{\A default-pathname-defaults
\A}}})
}
1315 Return
\retval{minimal path string
} that sufficiently describes
1316 the path of
\VAR{path-or-stream
} relative to
\VAR{root-path.
}
1319 \IT{\arrGOO{(
\FU*
{NAMESTRING
}\VAR{ path-or-stream
})\\
1320 (
\FU*
{FILE-NAMESTRING
}\VAR{ path-or-stream
})\\
1321 (
\FU*
{DIRECTORY-NAMESTRING
}\VAR{ path-or-stream
})\\
1322 (
\FU*
{HOST-NAMESTRING
}\VAR{ path-or-stream
})
}{.
}}
1324 Return string representing
\retval{full pathname
};
\retval{name,
1325 type, and version
};
\retval{directory name
}; or
\retval{host
1326 name
}, respectively, of
\VAR{path-or-stream
}.
1329 \IT{(
\FU*
{TRANSLATE-PATHNAME
} \VAR{path-or-stream
} \VAR{wildcard-path-a
}
1330 \VAR{wildcard-path-b
})
}
1332 Translate the path of
\VAR{path-or-stream
} from
1333 \VAR{wildcard-path-a
} into
\VAR{wildcard-path-b
}. Return
1337 \IT{(
\FU*
{PATHNAME
} \VAR{path-or-stream
})
}
1339 \retval{Pathname
} of
\VAR{path-or-stream
}.
1342 \IT{(
\FU*
{LOGICAL-PATHNAME
} \VAR{logical-path-or-stream
})
}
1344 \retval{Logical pathname
} of
\VAR{logical-path-or-stream
}.
1345 Logical pathnames are represented as all-uppercase
1347 \Op{\VAR{host
}\LIT{:
}}%
1350 \Goop{\VAR{dir
}\XOR\LIT{*
}}\\
1351 \LIT{**
}}{\
}}\LIT{;
}}%
1352 \Goos{\VAR{name
}\XOR\LIT{*
}}%
1355 \Goop{\VAR{type
}\XOR\LIT{*
}}\\
1360 \VAR{version
}\XOR\LIT{*
}\XOR\LIT{newest
}\XOR\LIT{NEWEST
}}}}%
1362 \index{*@
\A}\index{**@
\A\A}%
1365 \IT{(
\FU*
{LOGICAL-PATHNAME-TRANSLATIONS
} \VAR{logical-host
})
}
1367 \retval{List of (
\VAR{from-wildcard to-wildcard
}) translations
}
1368 for
\VAR{logical-host
}.
\kwd{setf
}able.
1371 \IT{(
\FU*
{LOAD-LOGICAL-PATHNAME-TRANSLATIONS
} \VAR{logical-host
})
}
1373 Load
\VAR{logical-host
}'s translations. Return
\retval{\NIL} if already
1374 loaded; return
\retval{\T} if successful.
1377 \IT{(
\FU*
{TRANSLATE-LOGICAL-PATHNAME
} \VAR{path-or-stream
})
}
1379 \retval{Physical pathname
} corresponding to (possibly logical)
1380 pathname of
\VAR{path-or-stream
}.
1383 \IT{\arrGOO{(
\FU*
{PROBE-FILE
} \VAR{ file
})\\
1384 (
\FU*
{TRUENAME
} \VAR{ file
})
}{.
}}
1386 \retval{Canonical name
} of
\VAR{file
}. If
\VAR{file
} does not exist,
1387 return
\retval{\NIL}/signal
\kwd{file-error
}, respectively.
1390 \IT{(
\FU*
{FILE-WRITE-DATE
} \VAR{file
})
}
1392 \retval{Time
} at which
\VAR{file
} was last written.
1395 \IT{(
\FU*
{FILE-AUTHOR
} \VAR{file
})
\qquad\qquad}
1397 Return
\retval{name of
\VAR{file
} owner
}.
1400 \IT{(
\FU*
{FILE-LENGTH
} \VAR{stream
})
}
1402 Return
\retval{length of
\VAR{stream
}}.
1405 \IT{(
\FU*
{RENAME-FILE
} \VAR{foo
} \VAR{bar
})
}
1407 Rename file
\VAR{foo
} to
\VAR{bar
}. Unspecified components of path
1408 \VAR{bar
} default to those of
\VAR{foo
}. Return
\retval{new
1409 pathname
},
\retvalii{old physical file name
}, and
\retvaliii{new
1410 physical file name
}.
1413 \IT{(
\FU*
{DELETE-FILE
} \VAR{file
})
}
1415 Delete
\VAR{file
}. Return
\retval{\T}.
1418 \IT{(
\FU*
{DIRECTORY
} \VAR{path
})
}
1420 \retval{List of pathnames
} matching
\VAR{path
}.
1423 \IT{(
\FU*
{ENSURE-DIRECTORIES-EXIST
} \VAR{path
} \Op{\kwd{:verbose
}
1426 Create parts of
\retval{\VAR{path
}} if necessary. Second return value is
1427 \retvalii{\T} if something has been created.
1434 % LocalWords: ies argumenth ar gu ment
1436 %%% Local Variables:
1438 %%% TeX-master: "clqr"