Little tweak to figure on types and classes.
[clqr.git] / clqr-control-structure.tex
blob8ab2bf24ca703e6f550623d4e31f5014686a8cf1
1 % Copyright (C) 2008, 2009, 2010 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 or any later version published by the Free Software
6 % Foundation; with no Invariant Sections, no Front-Cover Texts and
7 % no Back-Cover Texts. For details see file COPYING.
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \section{Control Structure}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 \subsection{Predicates}
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17 \begin{LIST}{1cm}
19 \IT{(\FU*{EQ} \VAR{foo bar})}
21 \retval{\T} if \VAR{foo} and \VAR{bar} are identical.
24 \IT{(\FU*{EQL} \VAR{foo bar})}
26 \retval{\T} if \VAR{foo} and \VAR{bar}
27 are identical, or the same \kwd{character}, or \kwd{number}s of the
28 same type and value.
31 \IT{(\FU*{EQUAL} \VAR{foo bar})}
33 \retval{\T} if \VAR{foo} and \VAR{bar}
34 are \FU{EQL}, or are equivalent \kwd{pathname}s, or are \kwd{cons}es with
35 \FU{equal} cars and cdrs, or are \kwd{string}s or \kwd{bit-vector}s with
36 \FU{eql} elements below their fill pointers.
39 \IT{(\FU*{EQUALP} \VAR{foo bar})}
41 \retval{\T} if \VAR{foo} and \VAR{bar} are identical; or are the
42 same \kwd{character} ignoring case; or are \kwd{number}s of the same
43 value ignoring type; or are equivalent \kwd{pathname}s; or are
44 \kwd{cons}es or \kwd{array}s of the same shape with \FU{equalp}
45 elements; or are structures of the same type with
46 \FU{equalp} elements; or are \kwd{hash-table}s of the same size
47 with the same \kwd{:test} function, the same keys in terms of
48 \kwd{:test} function, and \FU{equalp} elements.
51 \IT{(\FU*{NOT} \VAR{foo})}
53 \retval{\T} if \VAR{foo} is \NIL, \retval{\NIL} otherwise.
56 \IT{(\FU*{BOUNDP} \VAR{symbol})}
58 \retval{\T} if \VAR{symbol} is a special variable.
61 \IT{(\FU*{CONSTANTP} \VAR{foo} \Op{\VAR{environment}\DF{\NIL}})}
63 \retval{\T} if \VAR{foo} is a constant form.
66 \IT{(\FU*{FUNCTIONP} \VAR{foo})}
68 \retval{\T} if \VAR{foo} is of type \kwd{function}.
71 \IT{(\FU*{FBOUNDP} \xorGOO{\VAR{foo}\\
72 (\kwd{setf } \VAR{foo})}{\}})}
74 \retval{\T} if \VAR{foo} is a global function or macro.
78 \end{LIST}
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 \subsection{Variables}
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 \begin{LIST}{1cm}
87 \IT{(\xorGOO{%
88 \MC*{DEFCONSTANT}\\
89 \MC*{DEFPARAMETER}}{\}} \NEV{\VAR{foo}} \VAR{form}
90 \Op{\NEV{\VAR{doc}}})}
92 Assign value of \VAR{form} to global constant/dynamic variable \retval{\VAR{foo}}.
95 \IT{(\MC*{DEFVAR} \NEV{\VAR{foo}} \OP{\VAR{form}
96 \Op{\NEV{\VAR{doc}}}})}
98 Unless bound already, assign value of \VAR{form} to dynamic variable
99 \retval{\VAR{foo}}.
102 \IT{(\xorGOO{\MC*{SETF}\\
103 \MC*{PSETF}}{\}} \Goos{\VAR{place}
104 \VAR{form}})}
106 Set \VAR{place}s to primary values of \VAR{form}s. Return \retval{values
107 of last \VAR{form}}/\retval{\NIL}; work sequentially/in parallel, respectively.
110 \IT{(\xorGOO{\SO*{SETQ}\\
111 \MC*{PSETQ}}{\}} \Goos{\VAR{symbol}
112 \VAR{form}})}
114 Set \VAR{symbol}s to primary values of \VAR{form}s. Return \retval{value
115 of last \VAR{form}}/\retval{\NIL}; work sequentially/in parallel, respectively.
118 \IT{(\FU*{SET} \DES{\VAR{symbol}} \VAR{foo})}
120 Set \VAR{symbol}'s value cell to \retval{\VAR{foo}}. Deprecated.
123 \IT{(\MC*{MULTIPLE-VALUE-SETQ} \VAR{vars} \VAR{form})}
125 Set elements of \VAR{vars} to the values of
126 \VAR{form}. Return \retval{\VAR{form}'s primary value}.
129 \IT{(\MC*{SHIFTF} \RP{\DES{\VAR{place}}} \VAR{foo})}
131 Store value of \VAR{foo} in rightmost \VAR{place} shifting values of
132 \VAR{place}s left, returning \retval{first \VAR{place}}.
135 \IT{(\MC*{ROTATEF} \OPn{\DES{\VAR{place}}})}
137 Rotate values of \VAR{place}s left, old first becoming new last
138 \VAR{place}'s value. Return \retval{\NIL}.
141 \IT{(\FU*{MAKUNBOUND} \DES{\VAR{foo}})}
143 Delete special variable \retval{\VAR{foo}} if any.
146 \label{:property_lists}
147 \IT{\arrGOO{(\FU*{GET} \VAR{ symbol} \VAR{ key }
148 \OP{\VAR{default}\DF{\NIL}})\\
149 (\FU*{GETF} \VAR{ place} \VAR{ key }
150 \OP{\VAR{default}\DF{\NIL}})}{.}}
152 \retval{First entry \VAR{key}} from property list stored in
153 \VAR{symbol}/in \VAR{place}, respectively, or \retval{\VAR{default}} if
154 there is no \VAR{key}. \kwd{setf}able.
157 \IT{(\FU*{GET-PROPERTIES} \VAR{property-list} \VAR{keys})}
159 Return \retval{key} and \retvalii{value} of first entry from \VAR{property-list}
160 matching a key from \VAR{keys}, and \retvaliii{tail of
161 \VAR{property-list}} starting with that key. Return \retval{\NIL},
162 \retvalii{\NIL}, and \retvaliii{\NIL} if there was no matching key
163 in \VAR{property-list}.
166 \IT{\arrGOO{(\FU*{REMPROP } \DES{\VAR{symbol}} \VAR{ key})\\
167 (\MC*{REMF } \DES{\VAR{place}} \VAR{ key})}{.}}
169 Remove first entry \VAR{key} from property list stored in
170 \VAR{symbol}/in \VAR{place}, respectively. Return \retval{\T} if \VAR{key}
171 was there, or \retval{\NIL} otherwise.
174 \end{LIST}
177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
178 \subsection{Functions}
179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180 \label{section:Functions}
182 \begin{flushleft}
183 Below, ordinary lambda list (\OPn{\VAR{ord-$\lambda$}}) has the form\\
184 % \VAR{var} referenced from DEFSTRUCT
185 (\OPn{\VAR{var}}
186 \OP{\kwd{\&optional} \xorGOO{%
187 \VAR{var}\\
188 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
189 \penalty-5
190 \Op{\kwd{\&rest} \VAR{var}}
191 \penalty-5
192 \OP{\kwd{\&key} \xorGOO{%
193 \VAR{var}\\
194 (\xorGOO{%
195 \VAR{var}\\
196 (\kwd{:}\VAR{key } \VAR{var})}{\}}
197 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ }\Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
198 \penalty-5
199 \Op{\kwd{\&allow-other-keys}}}
200 \penalty-5
201 \OP{\kwd{\&aux} \xorGOO{%
202 \VAR{var}\\
203 (\VAR{var } \Op{\VAR{init}\DF{\NIL}})}{\}^{\!\!*}}}).
204 \end{flushleft}
205 \VAR{supplied-p} is \T\ if there is a corresponding
206 argument. \VAR{init} forms can refer to any \VAR{init} and
207 \VAR{supplied-p} to their left.
209 \begin{LIST}{1cm}
211 \IT{(\xorGOO{\MC*{DEFUN }\xorGOO{\VAR{foo }(\VAR{\OPn{ord-$\lambda$}})\\
212 (\kwd{setf} \VAR{ foo})\text{ }(\VAR{new-value } \VAR{\OPn{ord-$\lambda$}})}{.}\\
213 \MC*{LAMBDA }(\VAR{\OPn{ord-$\lambda$}})}{\}}%
214 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
215 \Op{\NEV{\VAR{doc}}}
216 \PROGN{\VAR{form}})}
218 Define a function named \retval{\VAR{foo}} or \retval{(\kwd{setf}
219 \VAR{foo})}, or an anonymous \retval{function}, respectively, which applies
220 \VAR{form}s to \VAR{ord-$\lambda$}s. For \MC{defun}, \VAR{form}s are
221 enclosed in an implicit \SO{block} named \VAR{foo}.
224 \IT{(\xorGOO{\SO*{FLET}\\
225 \SO*{LABELS}}{\}}
226 (\OPn{(\xorGOO{\VAR{foo }(\OPn{\VAR{ord-$\lambda$}})\\
227 (\kwd{setf} \VAR{ foo})\text{ }(\VAR{new-value }\OPn{\VAR{ord-$\lambda$}})}{\}}%
228 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{local-decl}}})}
229 \Op{\NEV{\VAR{doc}}}
230 \PROGN{\VAR{local-form}})}) \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
231 \PROGN{\VAR{form}})}
233 Evaluate \VAR{form}s with
234 locally defined functions \VAR{foo}. Globally defined functions of
235 the same name are shadowed. Each \VAR{foo} is also the name of an
236 implicit \SO{block} around its corresponding \OPn{\VAR{local-form}}.
237 Only for \SO{LABELS}, functions \VAR{foo} are visible inside
238 \VAR{local-forms}. Return \retval{values of \VAR{form}s}.
241 \IT{(\SO*{FUNCTION} \xorGOO{%
242 \VAR{foo}\\
243 (\MC{lambda } \OPn{\VAR{form}})}{\}})}
245 Return lexically innermost \retval{function} named \VAR{foo} or a
246 lexical closure of the \retval{\MC{lambda} expression}.
249 \IT{(\FU*{APPLY} \xorGOO{\VAR{function}\\
250 (\kwd{setf } \VAR{function})}{\}} \OPn{\VAR{arg}} \VAR{args})}
252 Return \retval{values of \VAR{function}} called with
253 \VAR{arg}s and the list elements of \VAR{args}. \kwd{setf}able if
254 \VAR{function} is one of \FU{aref}, \FU{bit}, and \FU{sbit}.
257 \IT{(\FU*{FUNCALL} \VAR{function} \OPn{arg})}
259 Return \retval{values of \VAR{function}} called with \VAR{arg}s.
262 \IT{(\SO*{MULTIPLE-VALUE-CALL} \VAR{function} \OPn{\VAR{form}})}
263 {Call \VAR{function} with all the values of each \VAR{form} as its
264 arguments. Return \retval{values returned by \VAR{function}}.
267 \IT{(\FU*{VALUES-LIST} \VAR{list})}
269 Return \retval{elements of \VAR{list}}.
272 \IT{(\FU*{VALUES} \OPn{\VAR{foo}})}
274 Return as multiple values the \retval{primary values} of the
275 \VAR{foo}s. \kwd{setf}able.
278 \IT{(\FU*{MULTIPLE-VALUE-LIST} \VAR{form})}
280 \retval{List of the values of \VAR{form}}.
283 \IT{(\MC*{NTH-VALUE} \VAR{n} \VAR{form})}
285 Zero-indexed \retval{\VAR{n}th return value} of \VAR{form}.
288 \IT{(\FU*{COMPLEMENT} \VAR{function})}
290 Return \retval{new function} with same arguments and same side effects
291 as \VAR{function}, but with complementary truth value.
294 \IT{(\FU*{CONSTANTLY} \VAR{foo})}
296 Return \retval{function} of any number of arguments returning \VAR{foo}.
299 \IT{(\FU*{IDENTITY} \VAR{foo})}
301 Return \retval{\VAR{foo}}.
304 \IT{(\FU*{FUNCTION-LAMBDA-EXPRESSION} \VAR{function})}
306 If available, return \retval{lambda expression} of \VAR{function},
307 \retvalii{\NIL} if \VAR{function} was defined in an environment
308 without bindings, and \retvaliii{name} of \VAR{function}.
311 \IT{(\FU*{FDEFINITION} \xorGOO{\VAR{foo}\\
312 (\kwd{setf } \VAR{foo})}{\}})}
314 \retval{Definition} of global function \VAR{foo}. \kwd{setf}able.
317 \IT{(\FU*{FMAKUNBOUND} \VAR{foo})}
319 Remove global function or macro definition \retval{\VAR{foo}}.
322 \IT{\arrGOO{\CNS*{CALL-ARGUMENTS-LIMIT}\\
323 \CNS*{LAMBDA-PARAMETERS-LIMIT}}{.}}
325 Upper bound of the number of function arguments or lambda list
326 parameters, respectively; $\geq50$.
329 \IT{\CNS*{MULTIPLE-VALUES-LIMIT}}
331 Upper bound of the number of values a multiple value can have;
332 $\geq20$.
335 \end{LIST}
338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
339 \subsection{Macros}
340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341 \label{section:Macros}
343 \begin{flushleft}
344 Below, macro lambda list (\OPn{\VAR{macro-$\lambda$}}) has the form of
345 either
346 \penalty-5
347 (\Op{\kwd{\&whole} \VAR{var}}
348 \penalty-5
349 \Op{\VAR{E}}
350 \penalty-5
351 \xorGOO{%
352 \VAR{var}\\
353 (\OPn{\VAR{macro-$\lambda$}})}{\}^{\!\!*}}
354 \penalty-5
355 \Op{\VAR{E}}
356 \penalty-5
357 \Op{\kwd{\&optional}
358 \xorGOO{%
359 \VAR{var}\\
360 (\xorGOO{%
361 \VAR{var}\\
362 (\OPn{\VAR{macro-$\lambda$}})}{\}}\text{ }
363 \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
364 \penalty-5
365 \Op{\VAR{E}}
366 \penalty-5
367 \Op{%
368 \xorGOO{%
369 \kwd{\&rest}\\
370 \kwd{\&body}}{\}}
371 \xorGOO{%
372 \VAR{rest-var}\\
373 (\OPn{\VAR{macro-$\lambda$}})}{\}}}
374 \penalty-5
375 \Op{\VAR{E}}
376 \penalty-5
377 \OP{\kwd{\&key}
378 \xorGOO{%
379 \VAR{var}\\
380 (\xorGOO{%
381 \VAR{var}\\
382 (\kwd{:}\VAR{key } \xorGOO{%
383 \VAR{var}\\
384 (\OPn{\VAR{macro-$\lambda$}})}{\}})}{\}}
385 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
386 \Op{\VAR{E}}
387 \Op{\kwd{\&allow-other-keys}}}
388 \penalty-5
389 \Op{\kwd{\&aux}
390 \xorGOO{%
391 \VAR{var}\\
392 (\VAR{var } \Op{\VAR{init}\DF{\NIL}})}{\}^{\!\!*}}}
393 \penalty-5
394 \Op{\VAR{E}})
398 \penalty-5
399 (\Op{\kwd{\&whole}
400 \VAR{var}}
401 \penalty-5
402 \Op{\VAR{E}}
403 \penalty-5
404 \xorGOO{%
405 \VAR{var}\\
406 (\OPn{\VAR{macro-$\lambda$}})}{\}^{\!\!*}}
407 \penalty-5
408 \Op{\VAR{E}}
409 \penalty-5
410 \Op{\kwd{\&optional}
411 \xorGOO{%
412 \VAR{var}\\
413 (\xorGOO{%
414 \VAR{var}\\
415 (\OPn{\VAR{macro-$\lambda$}})}{\}}\text{ }
416 \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
417 \penalty-5
418 \Op{\VAR{E}}
419 \kwd{.}
420 \VAR{rest-var}).
421 \penalty-5
422 \end{flushleft}
423 One toplevel \Op{\VAR{E}} may be replaced by \kwd{\&environment}
424 \VAR{var}. \VAR{supplied-p} is \T\ if there is a corresponding
425 argument. \VAR{init} forms can refer to any \VAR{init} and
426 \VAR{supplied-p} to their left.
428 \begin{LIST}{1cm}
430 \IT{(\xorGOO{\MC*{DEFMACRO}\\
431 \FU*{DEFINE-COMPILER-MACRO}}{\}}
432 \xorGOO{\VAR{foo}\\
433 (\kwd{setf } \VAR{foo})}{\}}
434 (\OPn{\VAR{macro-$\lambda$}})
435 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \Op{\NEV{\VAR{doc}}}
436 \PROGN{\VAR{form}})}
438 Define macro \retval{\VAR{foo}} which on evaluation as (\VAR{foo}
439 \VAR{tree}) applies expanded \VAR{form}s to arguments from
440 \VAR{tree}, which corresponds to \VAR{tree}-shaped
441 \VAR{macro-$\lambda$}s. \VAR{form}s are enclosed in an implicit
442 \SO{block} named \VAR{foo}.
445 \IT{(\MC*{DEFINE-SYMBOL-MACRO} \VAR{foo} \VAR{form})}
447 Define symbol macro \retval{\VAR{foo}} which on evaluation evaluates
448 expanded \VAR{form}.
451 \IT{(\SO*{MACROLET} (\OPn{(\VAR{foo} (\OPn{\VAR{macro-$\lambda$}})
452 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{local-decl}}})}
453 \Op{\NEV{\VAR{doc}}} \PROGN{\VAR{macro-form}})}) \OPn{(\kwd{declare}
454 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
456 Evaluate \retval{\VAR{form}s} with locally defined mutually
457 invisible macros \VAR{foo} which are enclosed in implicit \SO{block}s
458 of the same name.
461 \IT{(\SO*{SYMBOL-MACROLET} (\OPn{(\VAR{foo}
462 \VAR{expansion-form})}) \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
463 \PROGN{\VAR{form}})}
465 Evaluate \retval{\VAR{form}s} with locally defined symbol macros
466 \VAR{foo}.
469 \IT{(\MC*{DEFSETF} \NEV{\VAR{function}} \xorGOO{%
470 \NEV{\VAR{updater}} \text{ } \Op{\NEV{\VAR{doc}}}\\
471 (\OPn{\VAR{setf-$\lambda$}}) \text{ } (\OPn{\VAR{s-var}}) \text{ }
472 \OPn{(\kwd{declare } \OPn{\NEV{\VAR{decl}}})}\text{ }
473 \Op{\NEV{\VAR{doc}}} \text{ } \PROGN{\VAR{form}}}{\}})
474 \penalty-5
475 where defsetf lambda list (\OPn{\VAR{setf-$\lambda$}}) has the form
476 \penalty-5
477 (\OPn{\VAR{var}}
478 \OP{\kwd{\&optional} \xorGOO{%
479 \VAR{var}\\
480 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
481 \penalty-5
482 \Op{\kwd{\&rest} \VAR{var}}
483 \penalty-5
484 \OP{\kwd{\&key} \xorGOO{%
485 \VAR{var}\\
486 (\xorGOO{%
487 \VAR{var}\\
488 (\kwd{:}\VAR{key } \VAR{var})}{\}}
489 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ }\Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
490 \penalty-5
491 \Op{\kwd{\&allow-other-keys}}}
492 \penalty-5
493 \OP{\kwd{\&environment} \VAR{var}}%
497 Specify how to \kwd{setf} a place accessed by
498 \retval{\VAR{function}}.
499 \EM{Short form:} (\kwd{setf} (\VAR{function} \OPn{\VAR{arg}}) \VAR{value-form}) is
500 replaced by (\VAR{updater} \OPn{\VAR{arg}} \VAR{value-form}); the
501 latter must return \VAR{value-form}.
502 \EM{Long form:} on invocation of (\kwd{setf} (\VAR{function}
503 \OPn{\VAR{arg}}) \VAR{value-form}), \VAR{form}s must expand
504 into code that sets the place accessed where \VAR{setf-$\lambda$}
505 and \OPn{\VAR{s-var}} describe the arguments of \VAR{function} and
506 the value(s) to be stored, respectively; and that returns
507 the value(s) of \OPn{\VAR{s-var}}. \VAR{form}s are enclosed in an
508 implicit \SO{block} named \VAR{function}.
511 \IT{(\MC*{DEFINE-SETF-EXPANDER} \VAR{function}
512 (\OPn{\VAR{macro-$\lambda$}})
513 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \Op{\NEV{\VAR{doc}}}
514 \PROGN{\VAR{form}})}
516 Specify how to \kwd{setf} a place accessed by
517 \retval{\VAR{function}}. On invocation of (\kwd{setf} (\VAR{function}
518 \OPn{\VAR{arg}}) \VAR{value-form}), \OPn{\VAR{form}} must expand
519 into code returning \VAR{arg-vars}, \VAR{args}, \VAR{newval-vars},
520 \VAR{set-form}, and \VAR{get-form} as described with
521 \FU{GET-SETF-EXPANSION} where the elements of macro
522 lambda list \OPn{\VAR{macro-$\lambda$}} are bound to corresponding
523 \VAR{arg}s. \VAR{form}s are enclosed in an implicit \SO{block}
524 named \VAR{function}.
527 \IT{(\FU*{GET-SETF-EXPANSION} \VAR{place} \Op{\VAR{environment}\DF{\NIL}})}
529 Return lists of temporary variables \retval{\VAR{arg-vars}} and of
530 corresponding \retvalii{\VAR{args}} as given with \VAR{place},
531 list \retvaliii{\VAR{\VAR{newval-vars}}} with temporary variables
532 corresponding to the new values, and \retvaln{4}{\VAR{set-form}}
533 and \retvaln{5}{\VAR{get-form}} specifying in terms of \VAR{arg-vars}
534 and \VAR{newval-vars} how to \kwd{setf} and how to read
535 \VAR{place}.
538 \IT{(\MC*{DEFINE-MODIFY-MACRO} \VAR{foo}
539 (\OP{\kwd{\&optional} \xorGOO{%
540 \VAR{var}\\
541 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ }
542 \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
543 \Op{\kwd{\&rest} \VAR{var}})
544 \VAR{function} \Op{\NEV{\VAR{doc}}})}
546 Define macro \retval{\VAR{foo}} able to modify a place. On
547 invocation of (\VAR{foo} \VAR{place} \OPn{\VAR{arg}}), the value of
548 \VAR{function} applied to \VAR{place} and \VAR{arg}s will be stored into
549 \VAR{place} and returned.
552 \IT{\CNS*{LAMBDA-LIST-KEYWORDS}}
553 {List of macro lambda list keywords. These are at least:
555 \begin{LIST}{.5cm}
557 \IT{\kwd*{\&whole} \VAR{var}}
558 {Bind \VAR{var} to the entire macro call form.}
560 \IT{\kwd*{\&optional} \OPn{\VAR{var}}}
561 {Bind \VAR{var}s to corresponding arguments if any.}
563 \IT{\Goo{%
564 \kwd*{\&rest}\XOR
565 \kwd*{\&body}} \VAR{var}}
566 {Bind \VAR{var} to a list of remaining arguments.}
568 \IT{\kwd*{\&key} \OPn{\VAR{var}}}
569 {Bind \VAR{var}s to corresponding keyword arguments.}
571 \IT{\kwd*{\&allow-other-keys}}
573 Suppress keyword argument checking. Callers can do so using
574 \kwd*{:allow-other-keys}~\T.
577 \IT{\kwd*{\&environment} \VAR{var}}
578 {Bind \VAR{var} to the lexical compilation environment.}
580 \IT{\kwd*{\&aux} \OPn{\VAR{var}}}
581 {Bind \VAR{var}s as in \SO{let\A}.}
583 \end{LIST}
584 \end{LIST}
587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
588 \subsection{Control Flow}
589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
590 \begin{LIST}{1cm}
592 \IT{(\SO*{IF} \VAR{test} \VAR{then} \Op{\VAR{else}\DF{\NIL}})}
594 Return values of \retval{\VAR{then}} if \VAR{test} returns \T;
595 return values of \retval{\VAR{else}} otherwise.
598 \IT{(\MC*{COND} \OPn{(\VAR{test} \PROGN{\VAR{then}}\DF{\VAR{test}})})}
600 Return the \retval{values} of the first
601 \OPn{\VAR{then}} whose \VAR{test} returns \T; return
602 \retval{\NIL} if all \VAR{test}s return \NIL.
605 \IT{(\xorGOO{\MC*{WHEN}\\
606 \MC*{UNLESS}}{\}} \VAR{test}
607 \PROGN{\VAR{foo}})}
609 Evaluate \VAR{foo}s and return \retval{their values} if \VAR{test}
610 returns \T\ or \NIL, respectively. Return \retval{\NIL} otherwise.
613 \IT{(\MC*{CASE} \VAR{test} \OPn{(\xorGOO{(\OPn{\NEV{\VAR{key}}})\\
614 \NEV{\VAR{key}}}{\}} \PROGN{\VAR{foo}})}
615 \OP{(\xorGOO{\kwd*{OTHERWISE}\\
616 \T}{\}} \PROGN{\VAR{bar}})\DF{\NIL}})}
618 Return the \retval{values} of the first \OPn{\VAR{foo}} one of whose \VAR{key}s is
619 \kwd{eql} \VAR{test}.
620 Return \retval{values of \VAR{bar}s} if there is no matching \VAR{key}.
623 \IT{(\xorGOO{\MC*{ECASE}\\
624 \MC*{CCASE}}{\}} \VAR{test}
625 \OPn{(\xorGOO{(\OPn{\NEV{\VAR{key}}})\\
626 \NEV{\VAR{key}}}{\}} \PROGN{\VAR{foo}})})}
628 Return the \retval{values} of the first \OPn{\VAR{foo}} one of whose \VAR{key}s is \kwd{eql}
629 \VAR{test}. Signal non-correctable/correctable \kwd{type-error} and
630 return \retval{\NIL} if there is no matching \VAR{key}.
633 \IT{(\MC*{AND} \OPn{\VAR{form}}\DF{\T})}
635 Evaluate \VAR{form}s from left to
636 right. Immediately return \retval{\NIL} if one \VAR{form}'s value is \NIL. Return
637 \retval{values of last \VAR{form}} otherwise.
640 \IT{(\MC*{OR} \OPn{\VAR{form}}\DF{\NIL})}
642 Evaluate \VAR{form}s from left to
643 right. Immediately return \retval{primary value} of first
644 non-\NIL-evaluating form, or \retval{all values} if last \VAR{form}
645 is reached. Return \retval{\NIL} if no \VAR{form} returns \T.
648 \IT{(\SO*{PROGN} \OPn{\VAR{form}}\DF{\NIL})}
649 {\label{:progn}
650 Evaluate \VAR{form}s sequentially. Return
651 \retval{values of last \VAR{form}}.
654 \IT{\arrGOO{%
655 (\SO*{MULTIPLE-VALUE-PROG1} \VAR{ form-r} \OPn{\VAR{ form}})\\
656 (\MC*{PROG1} \VAR{ form-r} \OPn{\VAR{ form}})\\
657 (\MC*{PROG2} \VAR{ form-a} \VAR{ form-r} \OPn{\VAR{ form}})}{.}}
659 Evaluate forms in order. Return \retval{values/1st value},
660 respectively, of \VAR{form-r}.
663 \IT{(\xorGOO{\SO*{LET}\\
664 \SO*{LET\A}}{\}}(%
665 \orGOO{\VAR{name}\\
666 (\VAR{name }\Op{\VAR{value}\DF{\NIL}})}{\}^{\!\!*}})
667 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
668 \PROGN{\VAR{form}})}
670 Evaluate \VAR{form}s with \VAR{name}s lexically bound (in parallel or
671 sequentially, respectively) to \VAR{value}s. Return
672 \retval{values of \VAR{form}s}.
675 \IT{(\xorGOO{\MC*{PROG}\\
676 \MC*{PROG\A}}{\}}
677 (\orGOO{%
678 \VAR{var}\\
679 (\VAR{var } \Op{\VAR{value}\DF{\NIL}})}{\}^{\!\!*}})
680 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
681 \xorGOO{\NEV{\VAR{tag}}\\\VAR{form}}{\}^{\!\!*}})}
683 Evaluate \SO{TAGBODY}-like body with \VAR{var}s locally bound (in
684 parallel or sequentially, respectively) to \VAR{value}s. Return
685 \retval{\NIL} or explicitly \retval{\MC{return}ed values}.
686 Implicitly, the whole form is a \SO{block} named \NIL.
689 \IT{(\SO*{PROGV} \VAR{symbols} \VAR{values} \PROGN{\VAR{form}})}
691 Evaluate \VAR{form}s with locally established dynamic bindings of
692 \VAR{symbols} to \VAR{values} or \NIL. Return \retval{values of
693 \VAR{form}s}.
696 \IT{(\SO*{UNWIND-PROTECT} \VAR{protected} \OPn{\VAR{cleanup}})}
698 Evaluate \VAR{protected} and then, no matter how control leaves
699 \VAR{protected}, \VAR{cleanup}s. Return \retval{values of
700 \VAR{protected}}.
703 \IT{(\MC*{DESTRUCTURING-BIND} \VAR{destruct-$\lambda$} \VAR{bar} \OPn{(\kwd{declare}
704 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
706 Evaluate \VAR{form}s with variables from tree \VAR{destruct-$\lambda$} bound to
707 corresponding elements of tree \VAR{bar}, and return \retval{their
708 values}. \VAR{destruct-$\lambda$} resembles \VAR{macro-$\lambda$}
709 (section \ref{section:Macros}), but without any \kwd{\&environment}
710 clause.
713 \IT{(\MC*{MULTIPLE-VALUE-BIND} (\OPn{\NEV{\VAR{var}}}) \VAR{values-form}
714 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{body-form}})}
716 Evaluate
717 \VAR{body-form}s with \VAR{var}s lexically bound to the return values of
718 \VAR{values-form}. Return \retval{values of \VAR{body-form}s}.
721 \IT{(\SO*{BLOCK} \VAR{name} \PROGN{\VAR{form}})}
723 Evaluate \VAR{form}s in a lexical environment, and
724 return \retval{their values} unless interrupted by
725 \SO{RETURN-FROM}.
728 \IT{\arrGOO{(\SO*{RETURN-FROM } \VAR{foo } \Op{\VAR{result}\DF{\NIL}})\\
729 (\MC*{RETURN } \Op{\VAR{result}\DF{\NIL}})}{.}}
731 Have nearest enclosing \SO{block} named \VAR{foo}/named \NIL,
732 respectively, return with values of \VAR{result}.
735 \IT{(\SO*{TAGBODY} \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
737 Evaluate \VAR{form}s in a lexical environment. \VAR{tag}s (symbols or integers) have lexical
738 scope and dynamic extent, and are targets for \SO{GO}. Return
739 \retval{\NIL}.
742 \IT{(\SO*{GO} \NEV{\VAR{tag}})}
744 Within the innermost enclosing \SO{tagbody}, jump to a tag \kwd{eql} \VAR{tag}.
747 \IT{(\SO*{CATCH} \VAR{tag} \PROGN{\VAR{form}})}
749 Evaluate \VAR{form}s and return \retval{their values} unless
750 interrupted by \SO{THROW}.
753 \IT{(\SO*{THROW} \VAR{tag} \VAR{form})}
754 {Have the nearest dynamically
755 enclosing \SO{CATCH} with a tag \FU{eq} \VAR{tag} return with the
756 values of \VAR{form}.
759 \IT{(\FU*{SLEEP} \VAR{n})}
760 {Wait \VAR{n} seconds, return \retval{\NIL}.
763 \end{LIST}
766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
767 \subsection{Iteration}
768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
770 \begin{LIST}{1cm}
772 \IT{(\xorGOO{\MC*{DO}\\
773 \MC*{DO\A}}{\}}
774 (\xorGOO{%
775 \VAR{var}\\
776 (\VAR{var } \OP{ \VAR{start } \Op{\VAR{step}}})}{\}^{\!\!*}})
777 (\VAR{stop} \PROGN{\VAR{result}})
778 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
779 \xorGOO{\NEV{\VAR{tag}}\\\VAR{form}}{\}^{\!\!*}})}
781 Evaluate \SO{TAGBODY}-like body with \VAR{var}s successively bound according
782 to the values of the corresponding \VAR{start} and \VAR{step}
783 forms. \VAR{var}s are bound in parallel/sequentially, respectively.
784 Stop iteration when \VAR{stop} is \T. Return \retval{values of
785 \OPn{\VAR{result}}}. Implicitly, the whole form is a \SO{block}
786 named \NIL.
789 \IT{(\MC*{DOTIMES} (\VAR{var} \VAR{i} \Op{\VAR{result}\DF{\NIL}})
790 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
791 \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
793 Evaluate \SO{TAGBODY}-like body with \VAR{var} successively bound
794 to integers from 0 to $i - 1$. Upon evaluation of
795 \retval{\VAR{result}}, \VAR{var} is \VAR{i}. Implicitly, the whole
796 form is a \SO{block} named \NIL.
799 \IT{(\MC*{DOLIST }(\VAR{var} \VAR{list} \Op{\VAR{result}\DF{\NIL}})
800 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
801 \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
803 Evaluate \SO{TAGBODY}-like body with \VAR{var} successively bound
804 to the elements of \VAR{list}. Upon evaluation of
805 \retval{\VAR{result}}, \VAR{var} is \NIL. Implicitly, the whole form
806 is a \SO{block} named \NIL.
810 \end{LIST}
812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
813 \subsection{Loop Facility}
814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
817 \begin{LIST}{1cm}
819 \IT{(\MC*{LOOP} \OPn{\VAR{form}})}
821 \EM{Simple Loop. } If \VAR{form}s do not contain any atomic Loop Facility
822 keywords, evaluate them forever in an implicit \SO{block} named \NIL.
825 \IT{(\MC*{LOOP} \OPn{\VAR{clause}})}
827 \EM{Loop Facility. } For Loop Facility keywords
828 see below and Figure \ref{loop-overview}.
831 \begin{LIST}{.5cm}
833 \IT{\LKWD*{named} \VAR{n}\DF{\NIL}}
835 Give \MC{loop}'s implicit \SO{block} a name.
838 \IT{\Goop{\LKWD*{with}
839 \xorGOO{%
840 \VAR{var-s}\\
841 (\OPn{\VAR{var-s}})}{\}}
842 \Op{\VAR{d-type}} \LKWD*{=} \VAR{foo}} \Goos{\LKWD*{and}
843 \xorGOO{%
844 \VAR{var-p}\\
845 (\OPn{\VAR{var-p}})}{\}}
846 \Op{\VAR{d-type}} \LKWD*{=} \VAR{bar}}
847 \penalty-10
848 where destructuring type specifier \VAR{d-type} has the form
849 \penalty-5
850 \GOO{\kwd{fixnum}\XOR
851 \kwd{float}\XOR
852 \T\XOR
853 \NIL\XOR
854 \GOo{%
855 \LKWD*{of-type}
856 \xorGOO{\VAR{type}\\
857 (\OPn{\VAR{type}})}{\}}}}
860 Initialize (possibly trees of) local variables \VAR{var-s}
861 sequentially and \VAR{var-p} in parallel.
864 \begin{figure}%
865 \begin{center}%
866 \begin{sideways}%
868 \arraycolsep0pt
870 \text{\kwd{loop}}\text{ }
871 \Op{
872 \text{\LKWD{named} \VAR{n}\DF{\NIL}}
874 \left\{
875 \begin{array}{l}
876 \text{\LKWD{with}
877 \xorGOO{%
878 \VAR{var}\\
879 (\OPn{\VAR{var}})}{\}}
880 \Op{\VAR{d-type}} \LKWD{=} \VAR{foo }}
881 \{\text{\LKWD{and}
882 \xorGOO{%
883 \VAR{var}\\
884 (\OPn{\VAR{var}})}{\}}
885 \Op{\VAR{d-type}} \LKWD{=}
886 \VAR{bar}}\}^{*} \\ \\[-2.4ex]
887 \left.\!
888 \begin{array}{l}
889 \text{\LKWD{for}} \\
890 \text{\LKWD{as}}
891 \end{array}\right\}
892 \boxed{
893 \text{\xorGOO{%
894 \VAR{var}\\
895 (\OPn{\VAR{var}})}{\}}}%
896 \Op{\VAR{d-type}}
897 \left\{
898 \begin{array}{l}
899 \left.\!
900 \begin{array}{l}
901 \OP{
902 \left\{
903 \begin{array}{l}
904 \text{\LKWD{upfrom}}\\
905 \text{\LKWD{from}}
906 \end{array}
907 \right\}
908 \text{\VAR{start}\DF{\LIT{0}}}
909 }\text{ }
910 \OP{
911 \left\{
912 \begin{array}{l}
913 \text{\LKWD{upto}}\\
914 \text{\LKWD{to}}\\
915 \text{\LKWD{below}}
916 \end{array}
917 \right\}
918 \text{\VAR{form}}
920 \text{\LKWD{from} \VAR{start}}
921 \left\{
922 \begin{array}{l}
923 \text{\LKWD{downto}}\\
924 \text{\LKWD{above}}
925 \end{array}
926 \right\}
927 \text{\VAR{form }}\\
928 \text{\LKWD{downfrom} \VAR{start}}\text{ }
929 \OP{
930 \left\{
931 \begin{array}{l}
932 \text{\LKWD{downto}}\\
933 \text{\LKWD{to}}\\
934 \text{\LKWD{above}}
935 \end{array}
936 \right\}
937 \text{\VAR{form}}
939 \end{array}
940 \right\}
941 \Op{
942 \text{\LKWD{by} \VAR{step}\DF{\LIT{1}}}
944 \left.\!
945 \begin{array}{l}
946 \text{\LKWD{in}} \\
947 \text{\LKWD{on}}
948 \end{array}
949 \right\}
950 \text{\VAR{list}}\text{ }
951 \Op{
952 \text{\LKWD{by} \VAR{function}\DF{\kwd{\#'cdr}}}
954 \text{\LKWD{=} \VAR{foo }}
955 \Op{
956 \text{\LKWD{then} \VAR{bar}\DF{\VAR{foo}}}
958 \text{\LKWD{across} \VAR{vector}}\\
959 \text{\LKWD{being}}
960 \left\{
961 \begin{array}{l}
962 \text{\LKWD{the}}\\
963 \text{\LKWD{each}}
964 \end{array}
965 \right\}%
966 \left\{
967 \begin{array}{{l}}
968 \left.\!
969 \begin{array}{l}
970 \text{\LKWD{hash-key\Op{s}}}
971 \left\{
972 \begin{array}{l}
973 \text{\LKWD{of}}\\
974 \text{\LKWD{in}}
975 \end{array}
976 \right\}
977 \text{\VAR{hash }}
978 \Op{
979 \text{\LKWD{using} (\LKWD{hash-value} \VAR{v})}%
981 \text{\LKWD{hash-value\Op{s}}}
982 \left\{
983 \begin{array}{l}
984 \text{\LKWD{of}}\\
985 \text{\LKWD{in}}
986 \end{array}
987 \right\}
988 \text{\VAR{hash }}
989 \Op{
990 \text{\LKWD{using} (\LKWD{hash-key} \VAR{k})}%
992 \end{array}
993 \right.\\
994 \left.\!
995 \begin{array}{l}
996 \text{\LKWD{symbol\Op{s}}}\\
997 \text{\LKWD{present-symbol\Op{s}}}\\
998 \text{\LKWD{external-symbol\Op{s}}}
999 \end{array}
1000 \right\}%
1001 \OP{
1002 \left\{
1003 \begin{array}{l}
1004 \text{\LKWD{of}}\\
1005 \text{\LKWD{in}}
1006 \end{array}
1007 \right\} \text{\VAR{package}\DF{\V{\A package\A}}}%
1009 \end{array}\!\!%
1010 \right.%
1011 \end{array}%
1012 \right\}_{{}^{{}^{\displaystyle{\mathbb{F}_0}}}}
1013 }%boxed
1014 \left\{
1015 \text{\LKWD{and} }\boxed{\mathbb{F}_i\!}
1016 \right\}^{\!*}\\
1017 \\[-2.4ex]
1018 \boxed{\;\mathbb{T}_1\,}
1020 \end{array}
1021 \right\}^{\displaystyle{\!\!*}}
1022 % Bottleneck
1023 \left\{
1024 \begin{array}{l}
1025 \boxed{
1026 \left.\!
1027 \begin{array}{l}
1028 \text{\LKWD{do\Op{ing}}}
1029 \text{ \VAR{form}}^{+}\\
1030 \left.\!
1031 \begin{array}{l}
1032 \text{\LKWD{if}}\\
1033 \text{\LKWD{when}}\\
1034 \text{\LKWD{unless}}
1035 \end{array}
1036 \right\}%
1037 \text{\VAR{test }}
1038 \boxed{\mathbb{C}_i\!}\{\text{\LKWD{and}}\,
1039 \boxed{\mathbb{C}_j\!}\}^{*}\Op{\text{\LKWD{else}}\,
1040 \boxed{\mathbb{C}_k\!}\{\text{\LKWD{and}}\,
1041 \boxed{\mathbb{C}_l\!}\}^{*}}
1042 \Op{\text{\LKWD{end}}}\!\!\!\!\!\!\!\\
1043 \text{\LKWD{return}}
1044 \left\{
1045 \begin{array}{l}
1046 \text{\VAR{form}}\\
1047 \text{\LKWD{it}}
1048 \end{array}
1049 \right.\\
1050 \left.\!
1051 \begin{array}{l}
1052 \text{\LKWD{collect\Op{ing}}}\\
1053 \text{\LKWD{append\Op{ing}}}\\
1054 \text{\LKWD{nconc\Op{ing}}}
1055 \end{array}
1056 \right\}
1057 \left\{
1058 \begin{array}{l}
1059 \text{\VAR{form}}\\
1060 \text{\LKWD{it}}
1061 \end{array}
1062 \right\} \Op{\text{\LKWD{into }\VAR{list}}}\\
1063 \left.\!
1064 \begin{array}{l}
1065 \text{\LKWD{count\Op{ing}}}\\
1066 \text{\LKWD{sum\Op{ming}}}\\
1067 \text{\LKWD{maximize}}\\
1068 \text{\LKWD{maximizing}}\\
1069 \text{\LKWD{minimize}}\\
1070 \text{\LKWD{minimizing}}
1071 \end{array}
1072 \right\}
1073 \left\{
1074 \begin{array}{l}
1075 \text{\VAR{form}}\\
1076 \text{\LKWD{it}}
1077 \end{array}
1078 \right\}
1079 \Op{\text{\LKWD{into }\VAR{num}}}\text{ }
1080 \Op{\text{\VAR{type}}}
1081 \end{array}
1082 \right._{{}^{{}^{\!\!\!\!\displaystyle{\mathbb{C}_0}}}}
1083 }%boxed
1085 \\[-2.4ex]
1086 \boxed{
1087 \left.\!
1088 \begin{array}{l}
1089 \left.\!
1090 \begin{array}{l}
1091 \text{\LKWD{initially}} \\
1092 \text{\LKWD{finally}}
1093 \end{array}
1094 \right\}
1095 \text{\VAR{form}}^{+}\\
1096 \text{\LKWD{repeat} \VAR{num}}\\
1097 \left.\!
1098 \begin{array}{l}
1099 \text{\LKWD{while}}\\
1100 \text{\LKWD{until}}\\
1101 \text{\LKWD{always}}\\
1102 \text{\LKWD{never}}\\
1103 \text{\LKWD{thereis}}
1104 \end{array}
1105 \right\}
1106 \text{\VAR{test}}
1107 \end{array}
1108 \right._{{}^{{}^{\displaystyle{\mathbb{T}_2}}}}
1109 }%boxed
1110 \end{array}
1111 \right\}^{\displaystyle{\!\!*}}
1113 \!)%
1114 \end{sideways}%
1115 \end{center}%
1116 \vspace{-3em}
1117 \raisebox{0em}[0em][0em]{\parbox[b]{4cm}{\caption{\protect\raggedright Loop Facility, Overview.\label{loop-overview}}}}
1118 \end{figure}
1120 \IT{\GOop{\Goo{\LKWD*{for}\XOR\LKWD*{as}}
1121 \xorGOO{%
1122 \VAR{var-s}\\
1123 (\OPn{\VAR{var-s}})}{\}}
1124 \Op{\VAR{d-type}}}
1125 \GOos{\LKWD*{and}
1126 \xorGOO{%
1127 \VAR{var-p}\\
1128 (\OPn{\VAR{var-p}})}{\}}
1129 \Op{\VAR{d-type}}}}
1131 Begin of iteration control clauses. Initialize and step (possibly
1132 trees of) local variables \VAR{var-s} sequentially and \VAR{var-p}
1133 in parallel. Destructuring type specifier \VAR{d-type} as with \LKWD{with}.
1136 \begin{LIST}{.5cm}
1138 \IT{\Goo{\LKWD*{upfrom}\XOR\LKWD*{from}\XOR\LKWD*{downfrom}}
1139 \VAR{start}}
1141 Start stepping with \VAR{start}
1144 \IT{\Goo{\LKWD*{upto}\XOR\LKWD*{downto}\XOR\LKWD*{to}\XOR\LKWD*{below}\XOR\LKWD*{above}}
1145 \VAR{form}}
1147 Specify \VAR{form} as the end value for stepping.
1150 \IT{\Goo{\LKWD*{in}\XOR\LKWD*{on}} \VAR{list}}
1152 Bind \VAR{var} to successive elements/tails, respectively, of \VAR{list}.
1155 \IT{\LKWD*{by} \Goo{\VAR{step}\DF{\LIT{1}}\XOR\VAR{function}\DF{\kwd{\#'cdr}}}}
1157 Specify the (positive) decrement or increment or the
1158 \VAR{function} of one argument returning the next part of the list.
1161 \IT{\LKWD*{=} \VAR{foo} \Op{\LKWD*{then}
1162 \VAR{bar}\DF{\VAR{foo}}}}
1164 Bind \VAR{var} in the first iteration to \VAR{foo} and later to \VAR{bar}.
1167 \IT{\LKWD*{across} \VAR{vector}}
1169 Bind \VAR{var} to successive elements of \VAR{vector}.
1172 \IT{\LKWD*{being} \Goo{\LKWD*{the}\XOR\LKWD*{each}}}
1174 Iterate over a hash table or a package.
1177 \begin{LIST}{.5cm}
1179 \IT{\Goo{\LKWD*{hash-key}\XOR\LKWD*{hash-keys}} \Goo{\LKWD*{of}\XOR\LKWD*{in}} \VAR{hash-table}
1180 \Op{\LKWD*{using} (\LKWD*{hash-value} \VAR{value})}}
1182 Bind \VAR{var} successively to the keys of \VAR{hash-table}; bind \VAR{value} to corresponding values.
1185 \IT{\Goo{\LKWD*{hash-value}\XOR\LKWD*{hash-values}} \Goo{\LKWD*{of}\XOR\LKWD*{in}} \VAR{hash-table}
1186 \Op{\LKWD*{using} (\LKWD*{hash-key} \VAR{key})}}
1188 Bind \VAR{var} successively to the values of \VAR{hash-table}; bind \VAR{key} to corresponding keys.
1191 \IT{\Goo{\LKWD*{symbol}\XOR\LKWD*{symbols}\XOR\LKWD*{present-symbol}\XOR\LKWD*{present-symbols}\XOR\LKWD*{external-symbol}\XOR\LKWD*{external-symbols}}
1192 \Op{\Goo{\LKWD*{of}\XOR\LKWD*{in}}
1193 \VAR{package}\DF{\V{\A package\A}}}}
1195 Bind \VAR{var} successively to the accessible symbols, or the present
1196 symbols, or the external symbols respectively, of
1197 \VAR{package}.
1200 \end{LIST}
1201 \end{LIST}
1203 \IT{\Goo{\LKWD*{do}\XOR\LKWD*{doing}} \RP{\VAR{form}}}
1205 Evaluate \VAR{form}s in every iteration.
1208 \IT{\Goo{\LKWD*{if}\XOR\LKWD*{when}\XOR\LKWD*{unless}} \VAR{ test}
1209 \VAR{i-clause} \Goos{\LKWD*{and}
1210 \VAR{j-clause}} \Op{\LKWD*{else} \VAR{k-clause} \Goos{\LKWD*{and}
1211 \VAR{l-clause}}} \Op{\LKWD*{end}}}
1213 If \VAR{test} returns \T, \T, or \NIL, respectively, evaluate
1214 \VAR{i-clause} and \VAR{j-clause}s; otherwise, evaluate \VAR{k-clause}
1215 and \VAR{l-clause}s.
1218 \begin{LIST}{.5cm}
1219 \IT{\LKWD*{it}}
1221 Inside \VAR{i-clause} or \VAR{k-clause}:
1222 \retval{value of \VAR{test}}.
1224 \end{LIST}
1226 \IT{\LKWD*{return} \Goo{\VAR{form}\XOR\LKWD*{it}}}
1228 Return immediately, skipping any \LKWD{finally} parts, with values of \VAR{form} or \LKWD{it}.
1231 \IT{\Goo{\LKWD*{collect}\XOR\LKWD*{collecting}}
1232 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into} \VAR{list}}}
1234 Collect values of \VAR{form} or \LKWD{it} into \VAR{list}. If no
1235 \VAR{list} is given, collect into an anonymous list which is
1236 returned after termination.
1239 \IT{\Goo{\LKWD*{append}\XOR\LKWD*{appending}\XOR\LKWD*{nconc}\XOR\LKWD*{nconcing}}
1240 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1241 \VAR{list}}}
1243 Concatenate values of \VAR{form} or \LKWD{it}, which should be
1244 lists, into \VAR{list} by the means of \FU{append} or \FU{nconc},
1245 respectively. If no \VAR{list} is given, collect into an
1246 anonymous list which is returned after termination.
1249 \IT{\Goo{\LKWD*{count}\XOR\LKWD*{counting}}
1250 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1251 \VAR{n}} \Op{\VAR{type}}}
1253 Count the number of times the value of \VAR{form} or of \LKWD{it} is \T.
1254 If no \VAR{n} is given, count into an anonymous variable
1255 which is returned after termination.
1258 \IT{\Goo{\LKWD*{sum}\XOR\LKWD*{summing}}
1259 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1260 \VAR{sum}} \Op{\VAR{type}}}
1262 Calculate the sum of the primary values of \VAR{form} or of \LKWD{it}.
1263 If no \VAR{sum} is given, sum into an anonymous variable
1264 which is returned after termination.
1267 \IT{\Goo{\LKWD*{maximize}\XOR\LKWD*{maximizing}\XOR
1268 \LKWD*{minimize}\XOR
1269 \LKWD*{minimizing}} \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1270 \VAR{max-min}} \Op{\VAR{type}}}
1272 Determine the maximum or minimum, respectively, of the primary values of
1273 \VAR{form} or of \LKWD{it}.
1274 If no \VAR{max-min} is given, use an anonymous variable
1275 which is returned after termination.
1278 \IT{\Goo{\LKWD*{initially}\XOR\LKWD*{finally}} \RP{\VAR{form}}}
1280 Evaluate \VAR{form}s before begin, or after end, respectively, of iterations.
1283 \IT{\LKWD*{repeat} \VAR{num}}
1285 Terminate \MC{loop} after \VAR{num} iterations; \VAR{num} is evaluated once.
1288 \IT{\Goo{\LKWD*{while}\XOR\LKWD*{until}} \VAR{test}}
1290 Continue iteration until \VAR{test} returns \NIL\ or \T, respectively.
1293 \IT{\Goo{\LKWD*{always}\XOR\LKWD*{never}} \VAR{test}}
1295 Terminate \MC{loop} returning \NIL\ and skipping any
1296 \LKWD{finally} parts as soon as \VAR{test} is \NIL\ or \T,
1297 respectively. Otherwise continue \MC{loop} with its default return
1298 value set to \T.
1301 \IT{\LKWD*{thereis} \VAR{test}}
1303 Terminate \MC{loop} when \VAR{test} is \T\ and return value of
1304 \VAR{test}, skipping any \LKWD{finally} parts. Otherwise continue
1305 \MC{loop} with its default return value set to \NIL.
1308 \IT{(\MC*{loop-finish})}
1310 Terminate \MC{loop} immediately executing any \LKWD{finally}
1311 clauses and returning any accumulated results.
1313 \end{LIST}
1314 \end{LIST}
1319 % LocalWords: pt
1321 %%% Local Variables:
1322 %%% mode: latex
1323 %%% TeX-master: "clqr"
1324 %%% End: