loop overview figure changed
[clqr.git] / clqr-control-structure.tex
blob584624210e39ad662416f5ffeb3601ee4f7fb6ea
1 % Copyright (C) 2008, 2009 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 \kwd{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 \kwd{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}\\
212 (\kwd{setf} \VAR{ foo})}{.}\\
213 \MC*{LAMBDA}}{\}}
214 (\VAR{\OPn{ord-$\lambda$}}) \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} \VAR{foo}.
224 \IT{(\xorGOO{\SO*{FLET}\\
225 \SO*{LABELS}}{\}}
226 (\OPn{(\xorGOO{\VAR{foo}\\
227 (\kwd{setf} \VAR{ foo})}{\}}
228 (\OPn{\VAR{ord-$\lambda$}})
229 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{local-decl}}})}
230 \Op{\NEV{\VAR{doc}}}
231 \PROGN{\VAR{local-form}})}) \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
232 \PROGN{\VAR{form}})}
234 Evaluate \VAR{form}s with
235 locally defined functions \VAR{foo}. Globally defined functions of
236 the same name are shadowed. Each \VAR{foo} is also the name of an
237 implicit \SO{block} around its corresponding \OPn{\VAR{local-form}}.
238 Only for \SO{LABELS}, functions \VAR{foo} are visible inside
239 \VAR{local-forms}. Return \retval{values of \VAR{form}s}.
242 \IT{(\SO*{FUNCTION} \xorGOO{%
243 \VAR{foo}\\
244 (\MC{lambda } \OPn{\VAR{form}})}{\}})}
246 Return lexically innermost \retval{function} named \VAR{foo} or a
247 lexical closure of the \retval{\MC{lambda} expression}.
250 \IT{(\FU*{APPLY} \xorGOO{\VAR{function}\\
251 (\kwd{setf } \VAR{function})}{\}} \RP{\VAR{arg}})}
253 Return \retval{values of \VAR{function}} called on
254 \VAR{arg}s. Last \VAR{arg} must be a list. \kwd{setf}able if
255 \VAR{function} is one of \FU{aref}, \FU{bit}, and \FU{sbit}.
258 \IT{(\FU*{FUNCALL} \VAR{function} \OPn{arg})}
260 Return \retval{values of \VAR{function}} called with \VAR{arg}s.
263 \IT{(\SO*{MULTIPLE-VALUE-CALL} \VAR{foo} \OPn{\VAR{form}})}
264 {Call function
265 \VAR{foo} with all the values of each \VAR{form} as its arguments. Return
266 \retval{values returned by \VAR{foo}}.
269 \IT{(\FU*{VALUES-LIST} \VAR{list})}
271 Return \retval{elements of \VAR{list}}.
274 \IT{(\FU*{VALUES} \OPn{\VAR{foo}})}
276 Return as multiple values the \retval{primary values} of the
277 \VAR{foo}s. \kwd{setf}able.
280 \IT{(\FU*{MULTIPLE-VALUE-LIST} \VAR{form})}
282 Return in a \retval{list} values of \VAR{form}.
285 \IT{(\MC*{NTH-VALUE} \VAR{n} \VAR{form})}
287 Zero-indexed \retval{\VAR{n}th return value} of \VAR{form}.
290 \IT{(\FU*{COMPLEMENT} \VAR{function})}
292 Return \retval{new function} with same arguments and same side effects
293 as \VAR{function}, but with complementary truth value.
296 \IT{(\FU*{CONSTANTLY} \VAR{foo})}
298 Return \retval{function} of any number of arguments returning \VAR{foo}.
301 \IT{(\FU*{IDENTITY} \VAR{foo})}
303 Return \retval{\VAR{foo}}.
306 \IT{(\FU*{FUNCTION-LAMBDA-EXPRESSION} \VAR{function})}
308 If available, return \retval{lambda expression} of \VAR{function},
309 \retvalii{\NIL} if \VAR{function} was defined in an environment
310 without bindings, and \retvaliii{name} of \VAR{function}.
313 \IT{(\FU*{FDEFINITION} \xorGOO{\VAR{foo}\\
314 (\kwd{setf } \VAR{foo})}{\}})}
316 \retval{Definition} of global function \VAR{foo}. \kwd{setf}able.
319 \IT{(\FU*{FMAKUNBOUND} \VAR{foo})}
321 Remove global function or macro definition \retval{\VAR{foo}}.
324 \IT{\arrGOO{\CNS*{CALL-ARGUMENTS-LIMIT}\\
325 \CNS*{LAMBDA-PARAMETERS-LIMIT}}{.}}
327 Upper bound of the number of function arguments or lambda list
328 parameters, respectively; $\geq50$.
331 \IT{\CNS*{MULTIPLE-VALUES-LIMIT}}
333 Upper bound of the number of values a multiple value can have;
334 $\geq20$.
337 \end{LIST}
340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341 \subsection{Macros}
342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
343 \label{section:Macros}
345 \begin{flushleft}
346 Below, macro lambda list (\OPn{\VAR{macro-$\lambda$}}) has the form of
347 either
348 \penalty-5
349 (\Op{\kwd{\&whole} \VAR{var}}
350 \penalty-5
351 \Op{\VAR{E}}
352 \penalty-5
353 \xorGOO{%
354 \VAR{var}\\
355 (\OPn{\VAR{macro-$\lambda$}})}{\}^{\!\!*}}
356 \penalty-5
357 \Op{\VAR{E}}
358 \penalty-5
359 \Op{\kwd{\&optional}
360 \xorGOO{%
361 \VAR{var}\\
362 (\xorGOO{%
363 \VAR{var}\\
364 (\OPn{\VAR{macro-$\lambda$}})}{\}}\text{ }
365 \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
366 \penalty-5
367 \Op{\VAR{E}}
368 \penalty-5
369 \Op{%
370 \xorGOO{%
371 \kwd{\&rest}\\
372 \kwd{\&body}}{\}}
373 \xorGOO{%
374 \VAR{var}\\
375 (\OPn{\VAR{macro-$\lambda$}})}{\}}}
376 \penalty-5
377 \Op{\VAR{E}}
378 \penalty-5
379 \OP{\kwd{\&key}
380 \xorGOO{%
381 \VAR{var}\\
382 (\xorGOO{%
383 \VAR{var}\\
384 (\kwd{:}\VAR{key } \xorGOO{%
385 \VAR{var}\\
386 (\OPn{\VAR{macro-$\lambda$}})}{\}})}{\}}
387 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
388 \Op{\VAR{E}}
389 \Op{\kwd{\&allow-other-keys}}}
390 \penalty-5
391 \Op{\kwd{\&aux}
392 \xorGOO{%
393 \VAR{var}\\
394 (\VAR{var } \Op{\VAR{init}\DF{\NIL}})}{\}^{\!\!*}}}
395 \penalty-5
396 \Op{\VAR{E}})
399 \penalty-5
400 (\Op{\kwd{\&whole}
401 \VAR{var}}
402 \penalty-5
403 \Op{\VAR{E}}
404 \penalty-5
405 \xorGOO{%
406 \VAR{var}\\
407 (\OPn{\VAR{macro-$\lambda$}})}{\}^{\!\!*}}
408 \penalty-5
409 \Op{\VAR{E}}
410 \penalty-5
411 \Op{\kwd{\&optional}
412 \xorGOO{%
413 \VAR{var}\\
414 (\xorGOO{%
415 \VAR{var}\\
416 (\OPn{\VAR{macro-$\lambda$}})}{\}}\text{ }
417 \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
418 \penalty-5
419 \Op{\VAR{E}}
420 \kwd{.}
421 \VAR{var}).
422 \penalty-5
423 \end{flushleft}
424 One toplevel \Op{\VAR{E}} may be replaced by \kwd{\&environment}
425 \VAR{var}. \VAR{supplied-p} is \T\ if there is a corresponding
426 argument. \VAR{init} forms can refer to any \VAR{init} and
427 \VAR{supplied-p} to their left.
429 \begin{LIST}{1cm}
431 \IT{(\xorGOO{\MC*{DEFMACRO}\\
432 \FU*{DEFINE-COMPILER-MACRO}}{\}}
433 \xorGOO{\VAR{foo}\\
434 (\kwd{setf } \VAR{foo})}{\}}
435 (\OPn{\VAR{macro-$\lambda$}})
436 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \Op{\NEV{\VAR{doc}}}
437 \PROGN{\VAR{form}})}
439 Define macro \retval{\VAR{foo}} which on evaluation as (\VAR{foo}
440 \VAR{tree}) applies expanded \VAR{form}s to arguments from
441 \VAR{tree}, which corresponds to \VAR{tree}-shaped
442 \VAR{macro-$\lambda$}s. \VAR{form}s are enclosed in an implicit
443 \SO{block} \VAR{foo}.
446 \IT{(\MC*{DEFINE-SYMBOL-MACRO} \VAR{foo} \VAR{form})}
448 Define symbol macro \retval{\VAR{foo}} which on evaluation evaluates
449 expanded \VAR{form}.
452 \IT{(\SO*{MACROLET} (\OPn{(\VAR{foo} (\OPn{\VAR{macro-$\lambda$}})
453 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{local-decl}}})}
454 \Op{\NEV{\VAR{doc}}} \PROGN{\VAR{macro-form}})}) \OPn{(\kwd{declare}
455 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
457 Evaluate \retval{\VAR{form}s} with locally defined mutually
458 invisible macros \VAR{foo} which are enclosed in implicit \SO{block}s
459 of the same name.
462 \IT{(\SO*{SYMBOL-MACROLET} (\OPn{(\VAR{foo}
463 \VAR{expansion-form})}) \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
464 \PROGN{\VAR{form}})}
466 Evaluate \retval{\VAR{form}s} with locally defined symbol macros
467 \VAR{foo}.
470 \IT{(\MC*{DEFSETF} \NEV{\VAR{function}} \xorGOO{%
471 \NEV{\VAR{updater}} \text{ } \Op{\NEV{\VAR{doc}}}\\
472 (\OPn{\VAR{setf-$\lambda$}}) \text{ } (\OPn{\VAR{s-var}}) \text{ }
473 \OPn{(\kwd{declare } \OPn{\NEV{\VAR{decl}}})}\text{ }
474 \Op{\NEV{\VAR{doc}}} \text{ } \PROGN{\VAR{form}}}{\}})
475 \penalty-5
476 where defsetf lambda list (\OPn{\VAR{setf-$\lambda$}}) has the form
477 \penalty-5
478 (\OPn{\VAR{var}}
479 \OP{\kwd{\&optional} \xorGOO{%
480 \VAR{var}\\
481 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
482 \penalty-5
483 \Op{\kwd{\&rest} \VAR{var}}
484 \penalty-5
485 \OP{\kwd{\&key} \xorGOO{%
486 \VAR{var}\\
487 (\xorGOO{%
488 \VAR{var}\\
489 (\kwd{:}\VAR{key } \VAR{var})}{\}}
490 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ }\Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
491 \penalty-5
492 \Op{\kwd{\&allow-other-keys}}}
493 \penalty-5
494 \OP{\kwd{\&environment} \VAR{var}}%
498 Specify how to \kwd{setf} a place accessed by
499 \retval{\VAR{function}}.
500 \EM{Short form:} (\kwd{setf} (\VAR{function} \OPn{\VAR{arg}}) \VAR{value-form}) is
501 replaced by (\VAR{updater} \OPn{\VAR{arg}} \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} \VAR{function}.
526 \IT{(\FU*{GET-SETF-EXPANSION} \VAR{place} \Op{\VAR{environment}\DF{\NIL}})}
528 Return lists of temporary variables \retval{\VAR{arg-vars}} and of
529 corresponding \retvalii{\VAR{args}} as given with \VAR{place},
530 list \retvaliii{\VAR{\VAR{newval-vars}}} with temporary variables
531 corresponding to the new values, and \retvaln{4}{\VAR{set-form}}
532 and \retvaln{5}{\VAR{get-form}} specifying in terms of \VAR{arg-vars}
533 and \VAR{newval-vars} how to \kwd{setf} and how to read
534 \VAR{place}.
537 \IT{(\MC*{DEFINE-MODIFY-MACRO} \VAR{foo}
538 (\OP{\kwd{\&optional} \xorGOO{%
539 \VAR{var}\\
540 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ }
541 \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
542 \Op{\kwd{\&rest} \VAR{var}})
543 \VAR{function} \Op{\NEV{\VAR{doc}}})}
545 Define macro \retval{\VAR{foo}} able to modify a place. On
546 invocation of (\VAR{foo} \VAR{place} \OPn{\VAR{arg}}), the value of
547 \VAR{function} applied to \VAR{place} and \VAR{arg}s will be stored into
548 \VAR{place} and returned.
551 \IT{\CNS*{LAMBDA-LIST-KEYWORDS}}
552 {List of macro lambda list keywords. These are at least:
554 \begin{LIST}{.5cm}
556 \IT{\kwd*{\&whole} \VAR{var}}
557 {Bind \VAR{var} to the entire macro call form.}
559 \IT{\kwd*{\&optional} \OPn{\VAR{var}}}
560 {Bind \VAR{var}s to corresponding arguments if any.}
562 \IT{\Goo{%
563 \kwd*{\&rest}\XOR
564 \kwd*{\&body}} \VAR{var}}
565 {Bind \VAR{var} to a list of remaining arguments.}
567 \IT{\kwd*{\&key} \OPn{\VAR{var}}}
568 {Bind \VAR{var}s to corresponding keyword arguments.}
570 \IT{\kwd*{\&allow-other-keys}}
572 Suppress keyword argument checking. Callers can do so using
573 \kwd*{:allow-other-keys}~\T.
576 \IT{\kwd*{\&environment} \VAR{var}}
577 {Bind \VAR{var} to the lexical compilation environment.}
579 \IT{\kwd*{\&aux} \OPn{\VAR{var}}}
580 {Bind \VAR{var}s as in \SO{let\A}.}
582 \end{LIST}
583 \end{LIST}
586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
587 \subsection{Control Flow}
588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589 \begin{LIST}{1cm}
591 \IT{(\SO*{IF} \VAR{test} \VAR{then} \Op{\VAR{else}\DF{\NIL}})}
593 Return values of \retval{\VAR{then}} if \VAR{test} returns \T;
594 return values of \retval{\VAR{else}} otherwise.
597 \IT{(\MC*{COND} \OPn{(\VAR{test} \PROGN{\VAR{then}}\DF{\VAR{test}})})}
599 Return the \retval{values} of the first
600 \OPn{\VAR{then}} whose \VAR{test} returns \T; return
601 \retval{\NIL} if all \VAR{test}s return \NIL.
604 \IT{(\xorGOO{\MC*{WHEN}\\
605 \MC*{UNLESS}}{\}} \VAR{test}
606 \PROGN{\VAR{foo}})}
608 Evaluate \VAR{foo}s and return \retval{their values} if \VAR{test}
609 returns \T\ or \NIL, respectively. Return \retval{\NIL} otherwise.
612 \IT{(\MC*{CASE} \VAR{test} \OPn{(\xorGOO{(\OPn{\NEV{\VAR{key}}})\\
613 \NEV{\VAR{key}}}{\}} \PROGN{\VAR{foo}})}
614 \OP{(\xorGOO{\kwd*{OTHERWISE}\\
615 \T}{\}} \PROGN{\VAR{bar}})\DF{\NIL}})}
617 Return the \retval{values} of the first \OPn{\VAR{foo}} one of whose \VAR{key}s is
618 \kwd{eql} \VAR{test}.
619 Return \retval{values of \VAR{bar}s} if there is no matching \VAR{key}.
622 \IT{(\xorGOO{\MC*{ECASE}\\
623 \MC*{CCASE}}{\}} \VAR{test}
624 \OPn{(\xorGOO{(\OPn{\NEV{\VAR{key}}})\\
625 \NEV{\VAR{key}}}{\}} \PROGN{\VAR{foo}})})}
627 Return the \retval{values} of the first \OPn{\VAR{foo}} one of whose \VAR{key}s is \kwd{eql}
628 \VAR{test}. Signal non-correctable/correctable \kwd{type-error} and
629 return \retval{\NIL} if there is no matching \VAR{key}.
632 \IT{(\MC*{AND} \OPn{\VAR{form}}\DF{\T})}
634 Evaluate \VAR{form}s from left to
635 right. Immediately return \retval{\NIL} if one \VAR{form}'s value is \NIL. Return
636 \retval{values of last \VAR{form}} otherwise.
639 \IT{(\MC*{OR} \OPn{\VAR{form}}\DF{\NIL})}
641 Evaluate \VAR{form}s from left to
642 right. Immediately return \retval{primary value} of first
643 non-\NIL-evaluating form, or \retval{all values} if last \VAR{form}
644 is reached. Return \retval{\NIL} if no \VAR{form} returns \T.
647 \IT{(\SO*{PROGN} \OPn{\VAR{form}}\DF{\NIL})}
648 {\label{:progn}
649 Evaluate \VAR{form}s sequentially. Return
650 \retval{values of last \VAR{form}}.
653 \IT{\arrGOO{%
654 (\SO*{MULTIPLE-VALUE-PROG1} \VAR{ form-r} \OPn{\VAR{ form}})\\
655 (\MC*{PROG1} \VAR{ form-r} \OPn{\VAR{ form}})\\
656 (\MC*{PROG2} \VAR{ form-a} \VAR{ form-r} \OPn{\VAR{ form}})}{.}}
658 Evaluate forms in order. Return \retval{values/1st value},
659 respectively, of \VAR{form-r}.
662 \IT{(\xorGOO{\SO*{LET}\\
663 \SO*{LET\A}}{\}}(%
664 \orGOO{\VAR{name}\\
665 (\VAR{name }\Op{\VAR{value}\DF{\NIL}})}{\}^{\!\!*}})
666 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
667 \PROGN{\VAR{form}})}
669 Evaluate \VAR{form}s with \VAR{name}s lexically bound (in parallel or
670 sequentially, respectively) to \VAR{value}s. Return
671 \retval{values of \VAR{form}s}.
674 \IT{(\xorGOO{\MC*{PROG}\\
675 \MC*{PROG\A}}{\}}
676 (\orGOO{%
677 \VAR{var}\\
678 (\VAR{var } \Op{\VAR{value}\DF{\NIL}})}{\}^{\!\!*}})
679 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
680 \xorGOO{\NEV{\VAR{tag}}\\\VAR{form}}{\}^{\!\!*}})}
682 Evaluate \SO{TAGBODY}-like body with \VAR{var}s locally bound (in
683 parallel or sequentially, respectively) to \VAR{value}s. Return
684 \retval{\NIL} or explicitly \retval{\MC{return}ed values}.
685 Implicitly, the whole form is a \SO{block} named \NIL.
688 \IT{(\SO*{PROGV} \VAR{symbols} \VAR{values} \PROGN{\VAR{form}})}
690 Evaluate \VAR{form}s with locally established dynamic bindings of
691 \VAR{symbols} to \VAR{values} or \NIL. Return \retval{values of
692 \VAR{form}s}.
695 \IT{(\SO*{UNWIND-PROTECT} \VAR{protected} \OPn{\VAR{cleanup}})}
697 Evaluate \VAR{protected} and then, no matter how control leaves
698 \VAR{protected}, \VAR{cleanup}s. Return \retval{values of
699 \VAR{protected}}.
702 \IT{(\MC*{DESTRUCTURING-BIND} \VAR{destruct-$\lambda$} \VAR{bar} \OPn{(\kwd{declare}
703 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
705 Evaluate \VAR{form}s with variables from tree \VAR{destruct-$\lambda$} bound to
706 corresponding elements of tree \VAR{bar}, and return \retval{their
707 values}. \VAR{destruct-$\lambda$} resembles \VAR{macro-$\lambda$}
708 (section \ref{section:Macros}), but without any \kwd{\&environment}
709 clause.
712 \IT{(\MC*{MULTIPLE-VALUE-BIND} (\OPn{\NEV{\VAR{var}}}) \VAR{values-form}
713 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{body-form}})}
715 Evaluate
716 \VAR{body-form}s with \VAR{var}s lexically bound to the return values of
717 \VAR{values-form}. Return \retval{values of \VAR{body-form}s}.
720 \IT{(\SO*{BLOCK} \VAR{name} \PROGN{\VAR{form}})}
722 Evaluate \VAR{form}s in a lexical environment, and
723 return \retval{their values} unless interrupted by
724 \SO{RETURN-FROM}.
727 \IT{\arrGOO{(\SO*{RETURN-FROM } \VAR{foo } \Op{\VAR{result}\DF{\NIL}})\\
728 (\MC*{RETURN } \Op{\VAR{result}\DF{\NIL}})}{.}}
730 Have nearest enclosing \SO{block} named \VAR{foo}/named \NIL,
731 respectively, return with values of \VAR{result}.
734 \IT{(\SO*{TAGBODY} \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
736 Evaluate \VAR{form}s in al lexical environment. \VAR{tag}s (symbols or integers) have lexical
737 scope and dynamic extent, and are targets for \SO{GO}. Return
738 \retval{\NIL}.
741 \IT{(\SO*{GO} \NEV{\VAR{tag}})}
743 Within the innermost enclosing \SO{tagbody}, jump to a tag \kwd{eql} \VAR{tag}.
746 \IT{(\SO*{CATCH} \VAR{tag} \PROGN{\VAR{form}})}
748 Evaluate \VAR{form}s and return \retval{their values} unless
749 interrupted by \SO{THROW}.
752 \IT{(\SO*{THROW} \VAR{tag} \VAR{form})}
753 {Have the nearest dynamically
754 enclosing \SO{CATCH} with a tag \FU{eq} \VAR{tag} return with the
755 values of \VAR{form}.
758 \IT{(\FU*{SLEEP} \VAR{n})}
759 {Wait \VAR{n} seconds, return \retval{\NIL}.
762 \end{LIST}
765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
766 \subsection{Iteration}
767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
769 \begin{LIST}{1cm}
771 \IT{(\xorGOO{\MC*{DO}\\
772 \MC*{DO\A}}{\}}
773 (\xorGOO{%
774 \VAR{var}\\
775 (\VAR{var } \OP{ \VAR{start } \Op{\VAR{step}}})}{\}^{\!\!*}})
776 (\VAR{stop} \PROGN{\VAR{result}})
777 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
778 \xorGOO{\NEV{\VAR{tag}}\\\VAR{form}}{\}^{\!\!*}})}
780 Evaluate \SO{TAGBODY}-like body with \VAR{var}s successively bound according
781 to the values of the corresponding \VAR{start} and \VAR{step}
782 forms. \VAR{var}s are bound in parallel/sequentially, respectively.
783 Stop iteration when \VAR{stop} is \T. Return \retval{values of
784 \OPn{\VAR{result}}}. Implicitly, the whole form is a \SO{block}
785 named \NIL.
788 \IT{(\MC*{DOTIMES} (\VAR{var} \VAR{i} \Op{\VAR{result}\DF{\NIL}})
789 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
790 \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
792 Evaluate \SO{TAGBODY}-like body with \VAR{var} successively bound
793 to integers from 0 to $i - 1$. Upon evaluation of
794 \retval{\VAR{result}}, \VAR{var} is \VAR{i}. Implicitly, the whole
795 form is a \SO{block} named \NIL.
798 \IT{(\MC*{DOLIST }(\VAR{var} \VAR{list} \Op{\VAR{result}\DF{\NIL}})
799 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
800 \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
802 Evaluate \SO{TAGBODY}-like body with \VAR{var} successively bound
803 to the elements of \VAR{list}. Upon evaluation of
804 \retval{\VAR{result}}, \VAR{var} is \NIL. Implicitly, the whole form
805 is a \SO{block} named \NIL.
809 \end{LIST}
811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
812 \subsection{Loop Facility}
813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
816 \begin{LIST}{1cm}
818 \IT{(\MC*{LOOP} \OPn{\VAR{form}})}
820 Simple Loop. If \VAR{form}s do not contain any atomic Loop Facility
821 keywords, evaluate them forever in an implicit \SO{block} named \NIL.
824 \IT{(\MC*{LOOP} \OPn{\VAR{form}})}
826 Loop Facility. For Loop Facility keywords
827 see below and Figure \ref{loop-overview}.
830 \begin{LIST}{.5cm}
832 \IT{\LKWD*{named} \VAR{n}\DF{\NIL}}
834 Give \MC{loop}'s implicit \SO{block} a name.
837 \IT{\Goop{\LKWD*{with}
838 \xorGOO{%
839 \VAR{var-s}\\
840 (\OPn{\VAR{var-s}})}{\}}
841 \Op{\VAR{d-type}} \LKWD*{=} \VAR{foo}} \Goos{\LKWD*{and}
842 \xorGOO{%
843 \VAR{var-p}\\
844 (\OPn{\VAR{var-p}})}{\}}
845 \Op{\VAR{d-type}} \LKWD*{=} \VAR{bar}}
846 \penalty-10
847 where destructuring type specifier \VAR{d-type} has the form
848 \penalty-5
849 \GOO{\kwd{fixnum}\XOR
850 \kwd{float}\XOR
851 \T\XOR
852 \NIL\XOR
853 \GOo{%
854 \LKWD*{of-type}
855 \xorGOO{\VAR{type}\\
856 (\OPn{\VAR{type}})}{\}}}}
859 Initialize (possibly trees of) local variables \VAR{var-s}
860 sequentially and \VAR{var-p} in parallel.
863 \IT{\Goo{\LKWD*{initially}\XOR\LKWD*{finally}} \RP{\VAR{form}}}
865 Evaluate \VAR{form}s before begin, or after end, respectively, of iterations.
868 \begin{figure}%
869 \begin{center}%
870 \begin{sideways}%
872 \arraycolsep0pt
874 \text{\kwd{loop}}\text{ }
875 \Op{
876 \text{\LKWD{named} \VAR{n}\DF{\NIL}}
878 \left\{
879 \begin{array}{l}
880 \text{\LKWD{with}
881 \xorGOO{%
882 \VAR{var}\\
883 (\OPn{\VAR{var}})}{\}}
884 \Op{\VAR{d-type}} \LKWD{=} \VAR{foo }}
885 \{\text{\LKWD{and}
886 \xorGOO{%
887 \VAR{var}\\
888 (\OPn{\VAR{var}})}{\}}
889 \Op{\VAR{d-type}} \LKWD{=}
890 \VAR{bar}}\}^{*} \\ \\[-2.4ex]
891 \left.\!
892 \begin{array}{l}
893 \text{\LKWD{for}} \\
894 \text{\LKWD{as}}
895 \end{array}\right\}
896 \boxed{
897 \text{\xorGOO{%
898 \VAR{var}\\
899 (\OPn{\VAR{var}})}{\}}}%
900 \Op{\VAR{d-type}}
901 \left\{
902 \begin{array}{l}
903 \left.\!
904 \begin{array}{l}
905 \OP{
906 \left\{
907 \begin{array}{l}
908 \text{\LKWD{upfrom}}\\
909 \text{\LKWD{from}}
910 \end{array}
911 \right\}
912 \text{\VAR{start}\DF{\LIT{0}}}
913 }\text{ }
914 \OP{
915 \left\{
916 \begin{array}{l}
917 \text{\LKWD{upto}}\\
918 \text{\LKWD{to}}\\
919 \text{\LKWD{below}}
920 \end{array}
921 \right\}
922 \text{\VAR{form}}
924 \text{\LKWD{from} \VAR{start}}
925 \left\{
926 \begin{array}{l}
927 \text{\LKWD{downto}}\\
928 \text{\LKWD{above}}
929 \end{array}
930 \right\}
931 \text{\VAR{form }}\\
932 \text{\LKWD{downfrom} \VAR{start}}\text{ }
933 \OP{
934 \left\{
935 \begin{array}{l}
936 \text{\LKWD{downto}}\\
937 \text{\LKWD{to}}\\
938 \text{\LKWD{above}}
939 \end{array}
940 \right\}
941 \text{\VAR{form}}
943 \end{array}
944 \right\}
945 \Op{
946 \text{\LKWD{by} \VAR{step}\DF{\LIT{1}}}
948 \left.\!
949 \begin{array}{l}
950 \text{\LKWD{in}} \\
951 \text{\LKWD{on}}
952 \end{array}
953 \right\}
954 \text{\VAR{list}}\text{ }
955 \Op{
956 \text{\LKWD{by} \VAR{function}\DF{\kwd{\#'cdr}}}
958 \text{\LKWD{=} \VAR{foo }}
959 \Op{
960 \text{\LKWD{then} \VAR{bar}\DF{\VAR{foo}}}
962 \text{\LKWD{across} \VAR{vector}}\\
963 \text{\LKWD{being}}
964 \left\{
965 \begin{array}{l}
966 \text{\LKWD{the}}\\
967 \text{\LKWD{each}}
968 \end{array}
969 \right\}%
970 \left\{
971 \begin{array}{{l}}
972 \left.\!
973 \begin{array}{l}
974 \left.\!
975 \begin{array}{l}
976 \text{\LKWD{hash-key}}\\
977 \text{\LKWD{hash-keys}}
978 \end{array}
979 \right\}%
980 \left\{
981 \begin{array}{l}
982 \text{\LKWD{of}}\\
983 \text{\LKWD{in}}
984 \end{array}
985 \right\}
986 \text{\VAR{hash }}
987 \Op{
988 \text{\LKWD{using} (\LKWD{hash-value} \VAR{v})}%
990 \left.\!
991 \begin{array}{l}
992 \text{\LKWD{hash-value}}\\
993 \text{\LKWD{hash-values}}
994 \end{array}
995 \right\}%
996 \left\{
997 \begin{array}{l}
998 \text{\LKWD{of}}\\
999 \text{\LKWD{in}}
1000 \end{array}
1001 \right\}
1002 \text{\VAR{hash }}
1003 \Op{
1004 \text{\LKWD{using} (\LKWD{hash-key} \VAR{k})}%
1006 \end{array}
1007 \right.\\
1008 \left.\!
1009 \begin{array}{l}
1010 \text{\LKWD{symbol\Op{s}}}\\
1011 \text{\LKWD{present-symbol\Op{s}}}\\
1012 \text{\LKWD{external-symbol\Op{s}}}
1013 \end{array}
1014 \right\}%
1015 \OP{
1016 \left\{
1017 \begin{array}{l}
1018 \text{\LKWD{of}}\\
1019 \text{\LKWD{in}}
1020 \end{array}
1021 \right\} \text{\VAR{package}\DF{\V{\A package\A}}}%
1023 \end{array}\!\!%
1024 \right.%
1025 \end{array}%
1026 \right\}_{{}^{{}^{\displaystyle{\mathbb{F}_0}}}}
1027 }%boxed
1028 \left\{
1029 \text{\LKWD{and} }\boxed{\mathbb{F}_i\!}
1030 \right\}^{\!*}\\
1031 \\[-2.4ex]
1032 \boxed{\;\mathbb{T}_1\,}
1034 \end{array}
1035 \right\}^{\!\!\displaystyle{*}}
1036 % Bottleneck
1037 \left\{
1038 \begin{array}{l}
1039 \boxed{
1040 \left.\!
1041 \begin{array}{l}
1042 \left.\!
1043 \begin{array}{l}
1044 \text{\LKWD{do}}\\
1045 \text{\LKWD{doing}}
1046 \end{array}
1047 \right\}
1048 \text{\VAR{form}}^{+}\\
1049 \left.\!
1050 \begin{array}{l}
1051 \text{\LKWD{if}}\\
1052 \text{\LKWD{when}}\\
1053 \text{\LKWD{unless}}
1054 \end{array}
1055 \right\}%
1056 \text{\VAR{test }}
1057 \boxed{\mathbb{C}_i\!}\{\text{\LKWD{and}}\,
1058 \boxed{\mathbb{C}_j\!}\}^{*}\Op{\text{\LKWD{else}}\,
1059 \boxed{\mathbb{C}_k\!}\{\text{\LKWD{and}}\,
1060 \boxed{\mathbb{C}_l\!}\}^{*}}
1061 \Op{\text{\LKWD{end}}}\!\!\!\!\!\!\!\\
1062 \text{\LKWD{return}}
1063 \left\{
1064 \begin{array}{l}
1065 \text{\VAR{form}}\\
1066 \text{\LKWD{it}}
1067 \end{array}
1068 \right.\\
1069 \left.\!
1070 \begin{array}{l}
1071 \text{\LKWD{collect\Op{ing}}}\\
1072 \text{\LKWD{append\Op{ing}}}\\
1073 \text{\LKWD{nconc\Op{ing}}}
1074 \end{array}
1075 \right\}
1076 \left\{
1077 \begin{array}{l}
1078 \text{\VAR{form}}\\
1079 \text{\LKWD{it}}
1080 \end{array}
1081 \right\} \Op{\text{\LKWD{into }\VAR{list}}}\\
1082 \left.\!
1083 \begin{array}{l}
1084 \text{\LKWD{count\Op{ing}}}\\
1085 \text{\LKWD{sum\Op{ming}}}\\
1086 \text{\LKWD{maximize}}\\
1087 \text{\LKWD{maximizing}}\\
1088 \text{\LKWD{minimize}}\\
1089 \text{\LKWD{minimizing}}
1090 \end{array}
1091 \right\}
1092 \left\{
1093 \begin{array}{l}
1094 \text{\VAR{form}}\\
1095 \text{\LKWD{it}}
1096 \end{array}
1097 \right\}
1098 \Op{\text{\LKWD{into }\VAR{num}}}\text{ }
1099 \Op{\text{\VAR{type}}}
1100 \end{array}
1101 \right._{{}^{{}^{\!\!\!\!\displaystyle{\mathbb{C}_0}}}}
1102 }%boxed
1104 \\[-2.4ex]
1105 \boxed{
1106 \left.\!
1107 \begin{array}{l}
1108 \left.\!
1109 \begin{array}{l}
1110 \text{\LKWD{initially}} \\
1111 \text{\LKWD{finally}}
1112 \end{array}
1113 \right\}
1114 \text{\VAR{form}}^{+}\\
1115 \text{\LKWD{repeat} \VAR{num}}\\
1116 \left.\!
1117 \begin{array}{l}
1118 \text{\LKWD{while}}\\
1119 \text{\LKWD{until}}\\
1120 \text{\LKWD{always}}\\
1121 \text{\LKWD{never}}\\
1122 \text{\LKWD{thereis}}
1123 \end{array}
1124 \right\}
1125 \text{\VAR{test}}
1126 \end{array}
1127 \right._{{}^{{}^{\displaystyle{\mathbb{T}_2}}}}
1128 }%boxed
1129 \end{array}
1130 \right\}^{\displaystyle{\!\!*}}
1132 \!)%
1133 \end{sideways}%
1134 \end{center}%
1135 \vspace{-3em}
1136 \raisebox{0em}[0em][0em]{\parbox[b]{4cm}{\caption{\protect\raggedright Loop Facility, Overview.\label{loop-overview}}}}
1137 \end{figure}
1139 \IT{\GOop{\Goo{\LKWD*{for}\XOR\LKWD*{as}}
1140 \xorGOO{%
1141 \VAR{var-s}\\
1142 (\OPn{\VAR{var-s}})}{\}}
1143 \Op{\VAR{d-type}}}
1144 \GOos{\LKWD*{and}
1145 \xorGOO{%
1146 \VAR{var-p}\\
1147 (\OPn{\VAR{var-p}})}{\}}
1148 \Op{\VAR{d-type}}}}
1150 Begin of iteration control clauses. Initialize and step (possibly
1151 trees of) local variables \VAR{var-s} sequentially and \VAR{var-p}
1152 in parallel. Destructuring type specifier \VAR{d-type} as with \LKWD{with}.
1155 \begin{LIST}{.5cm}
1157 \IT{\Goo{\LKWD*{upfrom}\XOR\LKWD*{from}\XOR\LKWD*{downfrom}}
1158 \VAR{start}}
1160 Start stepping with \VAR{start}
1163 \IT{\Goo{\LKWD*{upto}\XOR\LKWD*{downto}\XOR\LKWD*{to}\XOR\LKWD*{below}\XOR\LKWD*{above}}
1164 \VAR{form}}
1166 Specify \VAR{form} as the end value for stepping.
1169 \IT{\Goo{\LKWD*{in}\XOR\LKWD*{on}} \VAR{list}}
1171 Bind \VAR{var} to successive elements/tails, respectively, of \VAR{list}.
1174 \IT{\LKWD*{by} \Goo{\VAR{step}\DF{\LIT{1}}\XOR\VAR{function}\DF{\kwd{\#'cdr}}}}
1176 Specify the (positive) decrement or increment or the
1177 \VAR{function} of one argument returning the next part of the list.
1180 \IT{\LKWD*{=} \VAR{foo} \Op{\LKWD*{then}
1181 \VAR{bar}\DF{\VAR{foo}}}}
1183 Bind \VAR{var} in the first iteration to \VAR{foo} and later to \VAR{bar}.
1186 \IT{\LKWD*{across} \VAR{vector}}
1188 Bind \VAR{var} to successive elements of \VAR{vector}.
1191 \IT{\LKWD*{being} \Goo{\LKWD*{the}\XOR\LKWD*{each}}}
1193 Iterate over a hash table or a package.
1196 \begin{LIST}{.5cm}
1198 \IT{\Goo{\LKWD*{hash-key}\XOR\LKWD*{hash-keys}} \Goo{\LKWD*{of}\XOR\LKWD*{in}} \VAR{hash-table}
1199 \Op{\LKWD*{using} (\LKWD*{hash-value} \VAR{value})}}
1201 Bind \VAR{var} successively to the keys of \VAR{hash-table}; bind \VAR{value} to corresponding values.
1204 \IT{\Goo{\LKWD*{hash-value}\XOR\LKWD*{hash-values}} \Goo{\LKWD*{of}\XOR\LKWD*{in}} \VAR{hash-table}
1205 \Op{\LKWD*{using} (\LKWD*{hash-key} \VAR{key})}}
1207 Bind \VAR{var} successively to the values of \VAR{hash-table}; bind \VAR{key} to corresponding keys.
1210 \IT{\Goo{\LKWD*{symbol}\XOR\LKWD*{symbols}\XOR\LKWD*{present-symbol}\XOR\LKWD*{present-symbols}\XOR\LKWD*{external-symbol}\XOR\LKWD*{external-symbols}}
1211 \Op{\Goo{\LKWD*{of}\XOR\LKWD*{in}}
1212 \VAR{package}\DF{\V{\A package\A}}}}
1214 Bind \VAR{var} successively to the accessible symbols, or the present
1215 symbols, or the external symbols respectively, of
1216 \VAR{package}.
1219 \end{LIST}
1220 \end{LIST}
1222 \IT{\Goo{\LKWD*{do}\XOR\LKWD*{doing}} \RP{\VAR{form}}}
1224 Evaluate \VAR{form}s in every iteration.
1227 \IT{\LKWD*{it}}
1229 Value of \VAR{test} form of an enclosing \LKWD{if},
1230 \LKWD{when}, or \LKWD{unless} clause.
1233 \IT{\LKWD*{return} \Goo{\VAR{form}\XOR\LKWD*{it}}}
1235 Return immediately, skipping any \LKWD{finally} parts, with values of \VAR{form} or \LKWD{it}.
1238 \IT{\Goo{\LKWD*{collect}\XOR\LKWD*{collecting}}
1239 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into} \VAR{list}}}
1241 Collect values of \VAR{form} or \LKWD{it} into \VAR{list}. If no
1242 \VAR{list} is given, collect into an anonymous list which is
1243 returned after termination.
1246 \IT{\Goo{\LKWD*{append}\XOR\LKWD*{appending}\XOR\LKWD*{nconc}\XOR\LKWD*{nconcing}}
1247 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1248 \VAR{list}}}
1250 Concatenate values of \VAR{form} or \LKWD{it}, which should be
1251 lists, into \VAR{list} by the means of \FU{append} or \FU{nconc},
1252 respectively. If no \VAR{list} is given, collect into an
1253 anonymous list which is returned after termination.
1256 \IT{\Goo{\LKWD*{count}\XOR\LKWD*{counting}}
1257 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1258 \VAR{n}} \Op{\VAR{type}}}
1260 Count the number of times the value of \VAR{form} or of \LKWD{it} is \T.
1261 If no \VAR{n} is given, count into an anonymous variable
1262 which is returned after termination.
1265 \IT{\Goo{\LKWD*{sum}\XOR\LKWD*{summing}}
1266 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1267 \VAR{sum}} \Op{\VAR{type}}}
1269 Calculate the sum of the primary values of \VAR{form} or of \LKWD{it}.
1270 If no \VAR{sum} is given, sum into an anonymous variable
1271 which is returned after termination.
1274 \IT{\Goo{\LKWD*{maximize}\XOR\LKWD*{maximizing}\XOR
1275 \LKWD*{minimize}\XOR
1276 \LKWD*{minimizing}} \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1277 \VAR{max-min}} \Op{\VAR{type}}}
1279 Determine the maximum or minimum, respectively, of the primary values of
1280 \VAR{form} or of \LKWD{it}.
1281 If no \VAR{max-min} is given, use an anonymous variable
1282 which is returned after termination.
1285 \IT{\Goo{\LKWD*{if}\XOR\LKWD*{when}\XOR\LKWD*{unless}} \VAR{ test}
1286 \VAR{i-form} \Goos{\LKWD*{and}
1287 \VAR{j-form}} \Op{\LKWD*{else} \VAR{k-form} \Goos{\LKWD*{and}
1288 \VAR{l-form}}} \Op{\LKWD*{end}}}
1290 If \VAR{test} returns \T, \T, or \NIL, respectively, evaluate
1291 \VAR{i-form} and \VAR{j-form}s; otherwise, evaluate \VAR{k-form}
1292 and \VAR{l-form}s. Inside \VAR{i-form} and \VAR{k-form}, the value
1293 of \VAR{test} is accessible by \LKWD*{it}.
1296 \IT{\LKWD*{repeat} \VAR{num}}
1298 Terminate \MC{loop} after \VAR{num} iterations; \VAR{num} is evaluated once.
1301 \IT{\Goo{\LKWD*{while}\XOR\LKWD*{until}} \VAR{test}}
1303 Continue iteration until \VAR{test} returns \NIL\ or \T, respectively.
1306 \IT{\Goo{\LKWD*{always}\XOR\LKWD*{never}} \VAR{test}}
1308 Terminate \MC{loop} returning \NIL\ and skipping any
1309 \LKWD{finally} parts as soon as \VAR{test} is \NIL\ or \T,
1310 respectively. Otherwise continue \MC{loop} with its default return
1311 value set to \T.
1314 \IT{\LKWD*{thereis} \VAR{test}}
1316 Terminate \MC{loop} when \VAR{test} is \T\ and return value of
1317 \VAR{test}, skipping any \LKWD{finally} parts. Otherwise continue
1318 \MC{loop} with its default return value set to \NIL.
1321 \IT{(\MC*{loop-finish})}
1323 Terminate \MC{loop} immediately executing any \LKWD{finally}
1324 clauses and returning any accumulated results.
1326 \end{LIST}
1327 \end{LIST}
1332 % LocalWords: pt
1334 %%% Local Variables:
1335 %%% mode: latex
1336 %%% TeX-master: "clqr"
1337 %%% End: