Update README
[clqr.git] / clqr-control-structure.tex
blob69c369cba8199d7265e9981c0b3bf2dc4d1b53dc
1 % Copyright (C) 2008, 2009, 2010, 2011 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 \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 \retval{Values of \VAR{function}} called with \VAR{arg}s.
262 \IT{(\SO*{MULTIPLE-VALUE-CALL} \VAR{function} \OPn{\VAR{form}})}
264 Call \VAR{function} with all the values of each \VAR{form} as its
265 arguments. Return \retval{values returned by \VAR{function}}.
268 \IT{(\FU*{VALUES-LIST} \VAR{list})}
270 Return \retval{elements of \VAR{list}}.
273 \IT{(\FU*{VALUES} \OPn{\VAR{foo}})}
275 Return as multiple values the \retval{primary values} of the
276 \VAR{foo}s. \kwd{setf}able.
279 \IT{(\FU*{MULTIPLE-VALUE-LIST} \VAR{form})}
281 \retval{List of the values of \VAR{form}}.
284 \IT{(\MC*{NTH-VALUE} \VAR{n} \VAR{form})}
286 Zero-indexed \retval{\VAR{n}th return value} of \VAR{form}.
289 \IT{(\FU*{COMPLEMENT} \VAR{function})}
291 Return \retval{new function} with same arguments and same side effects
292 as \VAR{function}, but with complementary truth value.
295 \IT{(\FU*{CONSTANTLY} \VAR{foo})}
297 \retval{Function} of any number of arguments returning \VAR{foo}.
300 \IT{(\FU*{IDENTITY} \VAR{foo})}
302 Return \retval{\VAR{foo}}.
305 \IT{(\FU*{FUNCTION-LAMBDA-EXPRESSION} \VAR{function})}
307 If available, return \retval{lambda expression} of \VAR{function},
308 \retvalii{\NIL} if \VAR{function} was defined in an environment
309 without bindings, and \retvaliii{name} of \VAR{function}.
312 \IT{(\FU*{FDEFINITION} \xorGOO{\VAR{foo}\\
313 (\kwd{setf } \VAR{foo})}{\}})}
315 \retval{Definition} of global function \VAR{foo}. \kwd{setf}able.
318 \IT{(\FU*{FMAKUNBOUND} \VAR{foo})}
320 Remove global function or macro definition \retval{\VAR{foo}}.
323 \IT{\arrGOO{\CNS*{CALL-ARGUMENTS-LIMIT}\\
324 \CNS*{LAMBDA-PARAMETERS-LIMIT}}{.}}
326 Upper bound of the number of function arguments or lambda list
327 parameters, respectively; $\geq50$.
330 \IT{\CNS*{MULTIPLE-VALUES-LIMIT}}
332 Upper bound of the number of values a multiple value can have;
333 $\geq20$.
336 \end{LIST}
339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
340 \subsection{Macros}
341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342 \label{section:Macros}
344 \begin{flushleft}
345 Below, macro lambda list (\OPn{\VAR{macro-$\lambda$}}) has the form of
346 either
347 \penalty-5
348 (\Op{\kwd{\&whole} \VAR{var}}
349 \penalty-5
350 \Op{\VAR{E}}
351 \penalty-5
352 \xorGOO{%
353 \VAR{var}\\
354 (\OPn{\VAR{macro-$\lambda$}})}{\}^{\!\!*}}
355 \penalty-5
356 \Op{\VAR{E}}
357 \penalty-5
358 \Op{\kwd{\&optional}
359 \xorGOO{%
360 \VAR{var}\\
361 (\xorGOO{%
362 \VAR{var}\\
363 (\OPn{\VAR{macro-$\lambda$}})}{\}}\text{ }
364 \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
365 \penalty-5
366 \Op{\VAR{E}}
367 \penalty-5
368 \Op{%
369 \xorGOO{%
370 \kwd{\&rest}\\
371 \kwd{\&body}}{\}}
372 \xorGOO{%
373 \VAR{rest-var}\\
374 (\OPn{\VAR{macro-$\lambda$}})}{\}}}
375 \penalty-5
376 \Op{\VAR{E}}
377 \penalty-5
378 \OP{\kwd{\&key}
379 \xorGOO{%
380 \VAR{var}\\
381 (\xorGOO{%
382 \VAR{var}\\
383 (\kwd{:}\VAR{key } \xorGOO{%
384 \VAR{var}\\
385 (\OPn{\VAR{macro-$\lambda$}})}{\}})}{\}}
386 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
387 \Op{\VAR{E}}
388 \Op{\kwd{\&allow-other-keys}}}
389 \penalty-5
390 \Op{\kwd{\&aux}
391 \xorGOO{%
392 \VAR{var}\\
393 (\VAR{var } \Op{\VAR{init}\DF{\NIL}})}{\}^{\!\!*}}}
394 \penalty-5
395 \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{rest-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} named \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}); the
502 latter must return \VAR{value-form}.
503 \EM{Long form:} on invocation of (\kwd{setf} (\VAR{function}
504 \OPn{\VAR{arg}}) \VAR{value-form}), \VAR{form}s must expand
505 into code that sets the place accessed where \VAR{setf-$\lambda$}
506 and \OPn{\VAR{s-var}} describe the arguments of \VAR{function} and
507 the value(s) to be stored, respectively; and that returns
508 the value(s) of \OPn{\VAR{s-var}}. \VAR{form}s are enclosed in an
509 implicit \SO{block} named \VAR{function}.
512 \IT{(\MC*{DEFINE-SETF-EXPANDER} \VAR{function}
513 (\OPn{\VAR{macro-$\lambda$}})
514 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \Op{\NEV{\VAR{doc}}}
515 \PROGN{\VAR{form}})}
517 Specify how to \kwd{setf} a place accessed by
518 \retval{\VAR{function}}. On invocation of (\kwd{setf} (\VAR{function}
519 \OPn{\VAR{arg}}) \VAR{value-form}), \OPn{\VAR{form}} must expand
520 into code returning \VAR{arg-vars}, \VAR{args}, \VAR{newval-vars},
521 \VAR{set-form}, and \VAR{get-form} as described with
522 \FU{GET-SETF-EXPANSION} where the elements of macro
523 lambda list \OPn{\VAR{macro-$\lambda$}} are bound to corresponding
524 \VAR{arg}s. \VAR{form}s are enclosed in an implicit \SO{block}
525 named \VAR{function}.
528 \IT{(\FU*{GET-SETF-EXPANSION} \VAR{place} \Op{\VAR{environment}\DF{\NIL}})}
530 Return lists of temporary variables \retval{\VAR{arg-vars}} and of
531 corresponding \retvalii{\VAR{args}} as given with \VAR{place},
532 list \retvaliii{\VAR{\VAR{newval-vars}}} with temporary variables
533 corresponding to the new values, and \retvaln{4}{\VAR{set-form}}
534 and \retvaln{5}{\VAR{get-form}} specifying in terms of \VAR{arg-vars}
535 and \VAR{newval-vars} how to \kwd{setf} and how to read
536 \VAR{place}.
539 \IT{(\MC*{DEFINE-MODIFY-MACRO} \VAR{foo}
540 (\OP{\kwd{\&optional} \xorGOO{%
541 \VAR{var}\\
542 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ }
543 \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
544 \Op{\kwd{\&rest} \VAR{var}})
545 \VAR{function} \Op{\NEV{\VAR{doc}}})}
547 Define macro \retval{\VAR{foo}} able to modify a place. On
548 invocation of (\VAR{foo} \VAR{place} \OPn{\VAR{arg}}), the value of
549 \VAR{function} applied to \VAR{place} and \VAR{arg}s will be stored into
550 \VAR{place} and returned.
553 \IT{\CNS*{LAMBDA-LIST-KEYWORDS}}
554 {List of macro lambda list keywords. These are at least:
556 \begin{LIST}{.5cm}
558 \IT{\kwd*{\&whole} \VAR{var}}
559 {Bind \VAR{var} to the entire macro call form.}
561 \IT{\kwd*{\&optional} \OPn{\VAR{var}}}
562 {Bind \VAR{var}s to corresponding arguments if any.}
564 \IT{\Goo{%
565 \kwd*{\&rest}\XOR
566 \kwd*{\&body}} \VAR{var}}
567 {Bind \VAR{var} to a list of remaining arguments.}
569 \IT{\kwd*{\&key} \OPn{\VAR{var}}}
570 {Bind \VAR{var}s to corresponding keyword arguments.}
572 \IT{\kwd*{\&allow-other-keys}}
574 Suppress keyword argument checking. Callers can do so using
575 \kwd*{:allow-other-keys}~\T.
578 \IT{\kwd*{\&environment} \VAR{var}}
579 {Bind \VAR{var} to the lexical compilation environment.}
581 \IT{\kwd*{\&aux} \OPn{\VAR{var}}}
582 {Bind \VAR{var}s as in \SO{let\A}.}
584 \end{LIST}
585 \end{LIST}
588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589 \subsection{Control Flow}
590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
591 \begin{LIST}{1cm}
593 \IT{(\SO*{IF} \VAR{test} \VAR{then} \Op{\VAR{else}\DF{\NIL}})}
595 Return values of \retval{\VAR{then}} if \VAR{test} returns \T;
596 return values of \retval{\VAR{else}} otherwise.
599 \IT{(\MC*{COND} \OPn{(\VAR{test} \PROGN{\VAR{then}}\DF{\VAR{test}})})}
601 Return the \retval{values} of the first \OPn{\VAR{then}} whose
602 \VAR{test} returns \T; return \retval{\NIL} if all \VAR{test}s
603 return \NIL.
606 \IT{(\xorGOO{\MC*{WHEN}\\
607 \MC*{UNLESS}}{\}} \VAR{test}
608 \PROGN{\VAR{foo}})}
610 Evaluate \VAR{foo}s and return \retval{their values} if \VAR{test}
611 returns \T\ or \NIL, respectively. Return \retval{\NIL} otherwise.
614 \IT{(\MC*{CASE} \VAR{test} \OPn{(\xorGOO{(\OPn{\NEV{\VAR{key}}})\\
615 \NEV{\VAR{key}}}{\}} \PROGN{\VAR{foo}})}
616 \OP{(\xorGOO{\kwd*{OTHERWISE}\\
617 \T}{\}} \PROGN{\VAR{bar}})\DF{\NIL}})}
619 Return the \retval{values} of the first \OPn{\VAR{foo}} one of
620 whose \VAR{key}s is \kwd{eql} \VAR{test}. Return \retval{values of
621 \VAR{bar}s} if there is no matching \VAR{key}.
624 \IT{(\xorGOO{\MC*{ECASE}\\
625 \MC*{CCASE}}{\}} \VAR{test}
626 \OPn{(\xorGOO{(\OPn{\NEV{\VAR{key}}})\\
627 \NEV{\VAR{key}}}{\}} \PROGN{\VAR{foo}})})}
629 Return the \retval{values} of the first \OPn{\VAR{foo}} one of
630 whose \VAR{key}s is \kwd{eql} \VAR{test}. Signal
631 non-correctable/correctable \kwd{type-error} and return
632 \retval{\NIL} if there is no matching \VAR{key}.
635 \IT{(\MC*{AND} \OPn{\VAR{form}}\DF{\T})}
637 Evaluate \VAR{form}s from left to right. Immediately return
638 \retval{\NIL} if one \VAR{form}'s value is \NIL. Return
639 \retval{values of last \VAR{form}} otherwise.
642 \IT{(\MC*{OR} \OPn{\VAR{form}}\DF{\NIL})}
644 Evaluate \VAR{form}s from left to
645 right. Immediately return \retval{primary value} of first
646 non-\NIL-evaluating form, or \retval{all values} if last \VAR{form}
647 is reached. Return \retval{\NIL} if no \VAR{form} returns \T.
650 \IT{(\SO*{PROGN} \OPn{\VAR{form}}\DF{\NIL})}
651 {\label{:progn}
652 Evaluate \VAR{form}s sequentially. Return
653 \retval{values of last \VAR{form}}.
656 \IT{\arrGOO{%
657 (\SO*{MULTIPLE-VALUE-PROG1} \VAR{ form-r} \OPn{\VAR{ form}})\\
658 (\MC*{PROG1} \VAR{ form-r} \OPn{\VAR{ form}})\\
659 (\MC*{PROG2} \VAR{ form-a} \VAR{ form-r} \OPn{\VAR{ form}})}{.}}
661 Evaluate forms in order. Return \retval{values/primary value},
662 respectively, of \VAR{form-r}.
665 \IT{(\xorGOO{\SO*{LET}\\
666 \SO*{LET\A}}{\}} (%
667 \orGOO{\VAR{name}\\
668 (\VAR{name }\Op{\VAR{value}\DF{\NIL}})}{\}^{\!\!*}})
669 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
670 \PROGN{\VAR{form}})}
672 Evaluate \VAR{form}s with \VAR{name}s lexically bound (in parallel or
673 sequentially, respectively) to \VAR{value}s. Return
674 \retval{values of \VAR{form}s}.
677 \IT{(\xorGOO{\MC*{PROG}\\
678 \MC*{PROG\A}}{\}}
679 (\orGOO{%
680 \VAR{name}\\
681 (\VAR{name } \Op{\VAR{value}\DF{\NIL}})}{\}^{\!\!*}})
682 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
683 \xorGOO{\NEV{\VAR{tag}}\\\VAR{form}}{\}^{\!\!*}})}
685 Evaluate \SO{TAGBODY}-like body with \VAR{name}s lexically bound (in
686 parallel or sequentially, respectively) to \VAR{value}s. Return
687 \retval{\NIL} or explicitly \retval{\MC{return}ed values}.
688 Implicitly, the whole form is a \SO{block} named \NIL.
691 \IT{(\SO*{PROGV} \VAR{symbols} \VAR{values} \PROGN{\VAR{form}})}
693 Evaluate \VAR{form}s with locally established dynamic bindings of
694 \VAR{symbols} to \VAR{values} or \NIL. Return \retval{values of
695 \VAR{form}s}.
698 \IT{(\SO*{UNWIND-PROTECT} \VAR{protected} \OPn{\VAR{cleanup}})}
700 Evaluate \VAR{protected} and then, no matter how control leaves
701 \VAR{protected}, \VAR{cleanup}s. Return \retval{values of
702 \VAR{protected}}.
705 \IT{(\MC*{DESTRUCTURING-BIND} \VAR{destruct-$\lambda$} \VAR{bar}
706 \OPn{(\kwd{declare}
707 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
709 Evaluate \VAR{form}s with variables from tree
710 \VAR{destruct-$\lambda$} bound to corresponding elements of tree
711 \VAR{bar}, and return \retval{their
712 values}. \VAR{destruct-$\lambda$} resembles \VAR{macro-$\lambda$}
713 (section \ref{section:Macros}), but without any \kwd{\&environment}
714 clause.
717 \IT{(\MC*{MULTIPLE-VALUE-BIND} (\OPn{\NEV{\VAR{var}}}) \VAR{values-form}
718 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{body-form}})}
720 Evaluate \VAR{body-form}s with \VAR{var}s lexically bound to the
721 return values of \VAR{values-form}. Return \retval{values of
722 \VAR{body-form}s}.
725 \IT{(\SO*{BLOCK} \VAR{name} \PROGN{\VAR{form}})}
727 Evaluate \VAR{form}s in a lexical environment, and
728 return \retval{their values} unless interrupted by
729 \SO{RETURN-FROM}.
732 \IT{\arrGOO{(\SO*{RETURN-FROM } \VAR{foo } \Op{\VAR{result}\DF{\NIL}})\\
733 (\MC*{RETURN } \Op{\VAR{result}\DF{\NIL}})}{.}}
735 Have nearest enclosing \SO{block} named \VAR{foo}/named \NIL,
736 respectively, return with values of \VAR{result}.
739 \IT{(\SO*{TAGBODY} \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
741 Evaluate \VAR{form}s in a lexical environment. \VAR{tag}s (symbols
742 or integers) have lexical scope and dynamic extent, and are
743 targets for \SO{GO}. Return \retval{\NIL}.
746 \IT{(\SO*{GO} \NEV{\VAR{tag}})}
748 Within the innermost possible enclosing \SO{tagbody}, jump to a
749 tag \kwd{eql} \VAR{tag}.
752 \IT{(\SO*{CATCH} \VAR{tag} \PROGN{\VAR{form}})}
754 Evaluate \VAR{form}s and return \retval{their values} unless
755 interrupted by \SO{THROW}.
758 \IT{(\SO*{THROW} \VAR{tag} \VAR{form})}
760 Have the nearest dynamically
761 enclosing \SO{CATCH} with a tag \FU{eq} \VAR{tag} return with the
762 values of \VAR{form}.
765 \IT{(\FU*{SLEEP} \VAR{n})}
767 Wait \VAR{n} seconds, return \retval{\NIL}.
770 \end{LIST}
773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
774 \subsection{Iteration}
775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
777 \begin{LIST}{1cm}
779 \IT{(\xorGOO{\MC*{DO}\\
780 \MC*{DO\A}}{\}}
781 (\xorGOO{%
782 \VAR{var}\\
783 (\VAR{var } \OP{ \VAR{start } \Op{\VAR{step}}})}{\}^{\!\!*}})
784 (\VAR{stop} \PROGN{\VAR{result}})
785 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
786 \xorGOO{\NEV{\VAR{tag}}\\\VAR{form}}{\}^{\!\!*}})}
788 Evaluate \SO{TAGBODY}-like body with \VAR{var}s successively bound
789 according to the values of the corresponding \VAR{start} and
790 \VAR{step} forms. \VAR{var}s are bound in parallel/sequentially,
791 respectively. Stop iteration when \VAR{stop} is \T. Return
792 \retval{values of \OPn{\VAR{result}}}. Implicitly, the whole form
793 is a \SO{block} named \NIL.
796 \IT{(\MC*{DOTIMES} (\VAR{var} \VAR{i} \Op{\VAR{result}\DF{\NIL}})
797 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
798 \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
800 Evaluate \SO{TAGBODY}-like body with \VAR{var} successively bound
801 to integers from 0 to $i - 1$. Upon evaluation of
802 \retval{\VAR{result}}, \VAR{var} is \VAR{i}. Implicitly, the whole
803 form is a \SO{block} named \NIL.
806 \IT{(\MC*{DOLIST }(\VAR{var} \VAR{list} \Op{\VAR{result}\DF{\NIL}})
807 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
808 \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
810 Evaluate \SO{TAGBODY}-like body with \VAR{var} successively bound
811 to the elements of \VAR{list}. Upon evaluation of
812 \retval{\VAR{result}}, \VAR{var} is \NIL. Implicitly, the whole form
813 is a \SO{block} named \NIL.
817 \end{LIST}
819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
820 \subsection{Loop Facility}
821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
824 \begin{LIST}{1cm}
826 \IT{(\MC*{LOOP} \OPn{\VAR{form}})}
828 \EM{Simple Loop. } If \VAR{form}s do not contain any atomic Loop
829 Facility keywords, evaluate them forever in an implicit \SO{block}
830 named \NIL.
833 \IT{(\MC*{LOOP} \OPn{\VAR{clause}})}
835 \EM{Loop Facility. } For Loop Facility keywords
836 see below and Figure \ref{loop-overview}.
839 \begin{LIST}{.5cm}
841 \IT{\LKWD*{named} \VAR{n}\DF{\NIL}}
843 Give \MC{loop}'s implicit \SO{block} a name.
846 \IT{\Goop{\LKWD*{with}
847 \xorGOO{%
848 \VAR{var-s}\\
849 (\OPn{\VAR{var-s}})}{\}}
850 \Op{\VAR{d-type}}
851 \Op{\LKWD*{=} \VAR{foo}}}
852 \Goos{\LKWD*{and}
853 \xorGOO{%
854 \VAR{var-p}\\
855 (\OPn{\VAR{var-p}})}{\}}
856 \Op{\VAR{d-type}}
857 \Op{\LKWD*{=} \VAR{bar}}}
858 \penalty-10
859 where destructuring type specifier \VAR{d-type} has the form
860 \penalty-5
861 \GOO{\kwd{fixnum}\XOR
862 \kwd{float}\XOR
863 \T\XOR
864 \NIL\XOR
865 \GOo{%
866 \LKWD*{of-type}
867 \xorGOO{\VAR{type}\\
868 (\OPn{\VAR{type}})}{\}}}}
871 Initialize (possibly trees of) local variables \VAR{var-s}
872 sequentially and \VAR{var-p} in parallel.
875 \begin{figure}%
876 \begin{center}%
877 \begin{sideways}%
879 \arraycolsep0pt
881 \text{\kwd{loop}}\text{ }
882 \Op{
883 \text{\LKWD{named} \VAR{n}\DF{\NIL}}
885 \left\{
886 \begin{array}{l}
887 \text{\LKWD{with}
888 \xorGOO{%
889 \VAR{var}\\
890 (\OPn{\VAR{var}})}{\}}
891 \Op{\VAR{d-type}}
892 \Op{\LKWD{=} \VAR{foo}}}
893 \text{ }
894 \{\text{\LKWD{and}
895 \xorGOO{%
896 \VAR{var}\\
897 (\OPn{\VAR{var}})}{\}}
898 \Op{\VAR{d-type}}
899 \Op{\LKWD{=} \VAR{bar}}}\}^{*} \\ \\[-2.4ex]
900 \left.\!
901 \begin{array}{l}
902 \text{\LKWD{for}} \\
903 \text{\LKWD{as}}
904 \end{array}\right\}
905 \boxed{
906 \text{\xorGOO{%
907 \VAR{var}\\
908 (\OPn{\VAR{var}})}{\}}}%
909 \Op{\VAR{d-type}}
910 \left\{
911 \begin{array}{l}
912 \left.\!
913 \begin{array}{l}
914 \OP{
915 \left\{
916 \begin{array}{l}
917 \text{\LKWD{upfrom}}\\
918 \text{\LKWD{from}}
919 \end{array}
920 \right\}
921 \text{\VAR{start}\DF{\LIT{0}}}
922 }\text{ }
923 \OP{
924 \left\{
925 \begin{array}{l}
926 \text{\LKWD{upto}}\\
927 \text{\LKWD{to}}\\
928 \text{\LKWD{below}}
929 \end{array}
930 \right\}
931 \text{\VAR{form}}
933 \text{\LKWD{from} \VAR{start}}
934 \left\{
935 \begin{array}{l}
936 \text{\LKWD{downto}}\\
937 \text{\LKWD{above}}
938 \end{array}
939 \right\}
940 \text{\VAR{form }}\\
941 \text{\LKWD{downfrom} \VAR{start}}\text{ }
942 \OP{
943 \left\{
944 \begin{array}{l}
945 \text{\LKWD{downto}}\\
946 \text{\LKWD{to}}\\
947 \text{\LKWD{above}}
948 \end{array}
949 \right\}
950 \text{\VAR{form}}
952 \end{array}
953 \right\}
954 \Op{
955 \text{\LKWD{by} \VAR{step}\DF{\LIT{1}}}
957 \left.\!
958 \begin{array}{l}
959 \text{\LKWD{in}} \\
960 \text{\LKWD{on}}
961 \end{array}
962 \right\}
963 \text{\VAR{list}}\text{ }
964 \Op{
965 \text{\LKWD{by} \VAR{function}\DF{\kwd{\#'cdr}}}
967 \text{\LKWD{=} \VAR{foo }}
968 \Op{
969 \text{\LKWD{then} \VAR{bar}\DF{\VAR{foo}}}
971 \text{\LKWD{across} \VAR{vector}}\\
972 \text{\LKWD{being}}
973 \left\{
974 \begin{array}{l}
975 \text{\LKWD{the}}\\
976 \text{\LKWD{each}}
977 \end{array}
978 \right\}%
979 \left\{
980 \begin{array}{{l}}
981 \left.\!
982 \begin{array}{l}
983 \text{\LKWD{hash-key\Op{s}}}
984 \left\{
985 \begin{array}{l}
986 \text{\LKWD{of}}\\
987 \text{\LKWD{in}}
988 \end{array}
989 \right\}
990 \text{\VAR{hash }}
991 \Op{
992 \text{\LKWD{using} (\LKWD{hash-value} \VAR{v})}%
994 \text{\LKWD{hash-value\Op{s}}}
995 \left\{
996 \begin{array}{l}
997 \text{\LKWD{of}}\\
998 \text{\LKWD{in}}
999 \end{array}
1000 \right\}
1001 \text{\VAR{hash }}
1002 \Op{
1003 \text{\LKWD{using} (\LKWD{hash-key} \VAR{k})}%
1005 \end{array}
1006 \right.\\
1007 \left.\!
1008 \begin{array}{l}
1009 \text{\LKWD{symbol\Op{s}}}\\
1010 \text{\LKWD{present-symbol\Op{s}}}\\
1011 \text{\LKWD{external-symbol\Op{s}}}
1012 \end{array}
1013 \right\}%
1014 \OP{
1015 \left\{
1016 \begin{array}{l}
1017 \text{\LKWD{of}}\\
1018 \text{\LKWD{in}}
1019 \end{array}
1020 \right\} \text{\VAR{package}\DF{\V{\A package\A}}}%
1022 \end{array}\!\!%
1023 \right.%
1024 \end{array}%
1025 \right\}_{{}^{{}^{\displaystyle{\mathbb{F}_0}}}}
1026 }%boxed
1027 \left\{
1028 \text{\LKWD{and} }\boxed{\mathbb{F}_i\!}
1029 \right\}^{\!*}\\
1030 \\[-2.4ex]
1031 \boxed{\;\mathbb{T}_1\,}
1033 \end{array}
1034 \right\}^{\displaystyle{\!\!*}}
1035 % Bottleneck
1036 \left\{
1037 \begin{array}{l}
1038 \boxed{
1039 \left.\!
1040 \begin{array}{l}
1041 \text{\LKWD{do\Op{ing}}}
1042 \text{ \VAR{form}}^{+}\\
1043 \left.\!
1044 \begin{array}{l}
1045 \text{\LKWD{if}}\\
1046 \text{\LKWD{when}}\\
1047 \text{\LKWD{unless}}
1048 \end{array}
1049 \right\}%
1050 \text{\VAR{test }}
1051 \boxed{\mathbb{C}_i\!}\{\text{\LKWD{and}}\,
1052 \boxed{\mathbb{C}_j\!}\}^{*}\Op{\text{\LKWD{else}}\,
1053 \boxed{\mathbb{C}_k\!}\{\text{\LKWD{and}}\,
1054 \boxed{\mathbb{C}_l\!}\}^{*}}
1055 \Op{\text{\LKWD{end}}}\!\!\!\!\!\!\!\\
1056 \text{\LKWD{return}}
1057 \left\{
1058 \begin{array}{l}
1059 \text{\VAR{form}}\\
1060 \text{\LKWD{it}}
1061 \end{array}
1062 \right.\\
1063 \left.\!
1064 \begin{array}{l}
1065 \text{\LKWD{collect\Op{ing}}}\\
1066 \text{\LKWD{append\Op{ing}}}\\
1067 \text{\LKWD{nconc\Op{ing}}}
1068 \end{array}
1069 \right\}
1070 \left\{
1071 \begin{array}{l}
1072 \text{\VAR{form}}\\
1073 \text{\LKWD{it}}
1074 \end{array}
1075 \right\} \Op{\text{\LKWD{into }\VAR{list}}}\\
1076 \left.\!
1077 \begin{array}{l}
1078 \text{\LKWD{count\Op{ing}}}\\
1079 \text{\LKWD{sum\Op{ming}}}\\
1080 \text{\LKWD{maximize}}\\
1081 \text{\LKWD{maximizing}}\\
1082 \text{\LKWD{minimize}}\\
1083 \text{\LKWD{minimizing}}
1084 \end{array}
1085 \right\}
1086 \left\{
1087 \begin{array}{l}
1088 \text{\VAR{form}}\\
1089 \text{\LKWD{it}}
1090 \end{array}
1091 \right\}
1092 \Op{\text{\LKWD{into }\VAR{num}}}\text{ }
1093 \Op{\text{\VAR{type}}}
1094 \end{array}
1095 \right._{{}^{{}^{\!\!\!\!\displaystyle{\mathbb{C}_0}}}}
1096 }%boxed
1098 \\[-2.4ex]
1099 \boxed{
1100 \left.\!
1101 \begin{array}{l}
1102 \left.\!
1103 \begin{array}{l}
1104 \text{\LKWD{initially}} \\
1105 \text{\LKWD{finally}}
1106 \end{array}
1107 \right\}
1108 \text{\VAR{form}}^{+}\\
1109 \text{\LKWD{repeat} \VAR{num}}\\
1110 \left.\!
1111 \begin{array}{l}
1112 \text{\LKWD{while}}\\
1113 \text{\LKWD{until}}\\
1114 \text{\LKWD{always}}\\
1115 \text{\LKWD{never}}\\
1116 \text{\LKWD{thereis}}
1117 \end{array}
1118 \right\}
1119 \text{\VAR{test}}
1120 \end{array}
1121 \right._{{}^{{}^{\displaystyle{\mathbb{T}_2}}}}
1122 }%boxed
1123 \end{array}
1124 \right\}^{\displaystyle{\!\!*}}
1126 \!)%
1127 \end{sideways}%
1128 \end{center}%
1129 \vspace{-3em}
1130 \raisebox{0em}[0em][0em]{\parbox[b]{4cm}{\caption{\protect\raggedright Loop Facility, Overview.\label{loop-overview}}}}
1131 \end{figure}
1133 \IT{\GOop{\Goo{\LKWD*{for}\XOR\LKWD*{as}}
1134 \xorGOO{%
1135 \VAR{var-s}\\
1136 (\OPn{\VAR{var-s}})}{\}}
1137 \Op{\VAR{d-type}}}
1138 \GOos{\LKWD*{and}
1139 \xorGOO{%
1140 \VAR{var-p}\\
1141 (\OPn{\VAR{var-p}})}{\}}
1142 \Op{\VAR{d-type}}}}
1144 Begin of iteration control clauses. Initialize and step (possibly
1145 trees of) local variables \VAR{var-s} sequentially and \VAR{var-p}
1146 in parallel. Destructuring type specifier \VAR{d-type} as with
1147 \LKWD{with}.
1150 \begin{LIST}{.5cm}
1152 \IT{\Goo{\LKWD*{upfrom}\XOR\LKWD*{from}\XOR\LKWD*{downfrom}}
1153 \VAR{start}}
1155 Start stepping with \VAR{start}
1158 \IT{\Goo{\LKWD*{upto}\XOR\LKWD*{downto}\XOR\LKWD*{to}\XOR\LKWD*{below}\XOR\LKWD*{above}}
1159 \VAR{form}}
1161 Specify \VAR{form} as the end value for stepping.
1164 \IT{\Goo{\LKWD*{in}\XOR\LKWD*{on}} \VAR{list}}
1166 Bind \VAR{var} to successive elements/tails, respectively, of
1167 \VAR{list}.
1170 \IT{\LKWD*{by} \Goo{\VAR{step}\DF{\LIT{1}}\XOR\VAR{function}\DF{\kwd{\#'cdr}}}}
1172 Specify the (positive) decrement or increment or the
1173 \VAR{function} of one argument returning the next part of the
1174 list.
1177 \IT{\LKWD*{=} \VAR{foo} \Op{\LKWD*{then}
1178 \VAR{bar}\DF{\VAR{foo}}}}
1180 Bind \VAR{var} initially to \VAR{foo} and later to
1181 \VAR{bar}.
1184 \IT{\LKWD*{across} \VAR{vector}}
1186 Bind \VAR{var} to successive elements of \VAR{vector}.
1189 \IT{\LKWD*{being} \Goo{\LKWD*{the}\XOR\LKWD*{each}}}
1191 Iterate over a hash table or a package.
1194 \begin{LIST}{.5cm}
1196 \IT{\Goo{\LKWD*{hash-key}\XOR\LKWD*{hash-keys}}
1197 \Goo{\LKWD*{of}\XOR\LKWD*{in}} \VAR{hash-table}
1198 \Op{\LKWD*{using} (\LKWD*{hash-value} \VAR{value})}}
1200 Bind \VAR{var} successively to the keys of \VAR{hash-table};
1201 bind \VAR{value} to corresponding values.
1204 \IT{\Goo{\LKWD*{hash-value}\XOR\LKWD*{hash-values}}
1205 \Goo{\LKWD*{of}\XOR\LKWD*{in}} \VAR{hash-table}
1206 \Op{\LKWD*{using} (\LKWD*{hash-key} \VAR{key})}}
1208 Bind \VAR{var} successively to the values of
1209 \VAR{hash-table}; bind \VAR{key} to corresponding keys.
1212 \IT{\Goo{\LKWD*{symbol}\XOR\LKWD*{symbols}\XOR\LKWD*{present-symbol}\XOR\LKWD*{present-symbols}\XOR\LKWD*{external-symbol}\XOR\LKWD*{external-symbols}}
1213 \Op{\Goo{\LKWD*{of}\XOR\LKWD*{in}}
1214 \VAR{package}\DF{\V{\A package\A}}}}
1216 Bind \VAR{var} successively to the accessible symbols, or
1217 the present symbols, or the external symbols respectively,
1218 of \VAR{package}.
1221 \end{LIST}
1222 \end{LIST}
1224 \IT{\Goo{\LKWD*{do}\XOR\LKWD*{doing}} \RP{\VAR{form}}}
1226 Evaluate \VAR{form}s in every iteration.
1229 \IT{\Goo{\LKWD*{if}\XOR\LKWD*{when}\XOR\LKWD*{unless}} \VAR{ test}
1230 \VAR{i-clause} \Goos{\LKWD*{and}
1231 \VAR{j-clause}} \Op{\LKWD*{else} \VAR{k-clause} \Goos{\LKWD*{and}
1232 \VAR{l-clause}}} \Op{\LKWD*{end}}}
1234 If \VAR{test} returns \T, \T, or \NIL, respectively, evaluate
1235 \VAR{i-clause} and \VAR{j-clause}s; otherwise, evaluate
1236 \VAR{k-clause} and \VAR{l-clause}s.
1239 \begin{LIST}{.5cm}
1240 \IT{\LKWD*{it}}
1242 Inside \VAR{i-clause} or \VAR{k-clause}:
1243 \retval{value of \VAR{test}}.
1245 \end{LIST}
1247 \IT{\LKWD*{return} \Goo{\VAR{form}\XOR\LKWD*{it}}}
1249 Return immediately, skipping any \LKWD{finally} parts, with
1250 values of \VAR{form} or \LKWD{it}.
1253 \IT{\Goo{\LKWD*{collect}\XOR\LKWD*{collecting}}
1254 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into} \VAR{list}}}
1256 Collect values of \VAR{form} or \LKWD{it} into \VAR{list}. If no
1257 \VAR{list} is given, collect into an anonymous list which is
1258 returned after termination.
1261 \IT{\Goo{\LKWD*{append}\XOR\LKWD*{appending}\XOR\LKWD*{nconc}\XOR\LKWD*{nconcing}}
1262 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1263 \VAR{list}}}
1265 Concatenate values of \VAR{form} or \LKWD{it}, which should be
1266 lists, into \VAR{list} by the means of \FU{append} or \FU{nconc},
1267 respectively. If no \VAR{list} is given, collect into an
1268 anonymous list which is returned after termination.
1271 \IT{\Goo{\LKWD*{count}\XOR\LKWD*{counting}}
1272 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1273 \VAR{n}} \Op{\VAR{type}}}
1275 Count the number of times the value of \VAR{form} or of \LKWD{it} is \T.
1276 If no \VAR{n} is given, count into an anonymous variable
1277 which is returned after termination.
1280 \IT{\Goo{\LKWD*{sum}\XOR\LKWD*{summing}}
1281 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1282 \VAR{sum}} \Op{\VAR{type}}}
1284 Calculate the sum of the primary values of \VAR{form} or of \LKWD{it}.
1285 If no \VAR{sum} is given, sum into an anonymous variable
1286 which is returned after termination.
1289 \IT{\Goo{\LKWD*{maximize}\XOR\LKWD*{maximizing}\XOR
1290 \LKWD*{minimize}\XOR
1291 \LKWD*{minimizing}} \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1292 \VAR{max-min}} \Op{\VAR{type}}}
1294 Determine the maximum or minimum, respectively, of the primary values of
1295 \VAR{form} or of \LKWD{it}.
1296 If no \VAR{max-min} is given, use an anonymous variable
1297 which is returned after termination.
1300 \IT{\Goo{\LKWD*{initially}\XOR\LKWD*{finally}} \RP{\VAR{form}}}
1302 Evaluate \VAR{form}s before begin, or after end, respectively,
1303 of iterations.
1306 \IT{\LKWD*{repeat} \VAR{num}}
1308 Terminate \MC{loop} after \VAR{num} iterations; \VAR{num} is
1309 evaluated once.
1312 \IT{\Goo{\LKWD*{while}\XOR\LKWD*{until}} \VAR{test}}
1314 Continue iteration until \VAR{test} returns \NIL\ or \T,
1315 respectively.
1318 \IT{\Goo{\LKWD*{always}\XOR\LKWD*{never}} \VAR{test}}
1320 Terminate \MC{loop} returning \NIL\ and skipping any
1321 \LKWD{finally} parts as soon as \VAR{test} is \NIL\ or \T,
1322 respectively. Otherwise continue \MC{loop} with its default
1323 return value set to \T.
1326 \IT{\LKWD*{thereis} \VAR{test}}
1328 Terminate \MC{loop} when \VAR{test} is \T\ and return value of
1329 \VAR{test}, skipping any \LKWD{finally} parts. Otherwise
1330 continue \MC{loop} with its default return value set to \NIL.
1333 \IT{(\MC*{loop-finish})}
1335 Terminate \MC{loop} immediately executing any \LKWD{finally}
1336 clauses and returning any accumulated results.
1338 \end{LIST}
1339 \end{LIST}
1344 % LocalWords: pt
1346 %%% Local Variables:
1347 %%% mode: latex
1348 %%% TeX-master: "clqr"
1349 %%% End: