Fix description of restart-bind
[clqr.git] / clqr-control-structure.tex
blob46f18c268c3cd032794863430dc70db215d9bb99
1 % Copyright (C) 2008, 2009, 2010, 2011, 2012 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})\qquad\qquad\qquad}
53 \retval{\T} if \VAR{foo} is \NIL; \retval{\NIL} otherwise.
56 \IT{(\FU*{BOUNDP} \VAR{symbol})\qquad\qquad}
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})\qquad\qquad}
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 \IT{(\SO*{PROGV} \VAR{symbols} \VAR{values} \PROGN{\VAR{form}})}
176 Evaluate \VAR{form}s with locally established dynamic bindings of
177 \VAR{symbols} to \VAR{values} or \NIL. Return \retval{values of
178 \VAR{form}s}.
181 \IT{(\xorGOO{%
182 \SO*{LET}\\
183 \SO*{LET\A}}{\}} (%
184 \orGOO{\VAR{name}\\
185 (\VAR{name }\Op{\VAR{value}\DF{\NIL}})}{\}^{\!\!*}})
186 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
187 \PROGN{\VAR{form}})}
189 Evaluate \VAR{form}s with \VAR{name}s lexically bound (in parallel or
190 sequentially, respectively) to \VAR{value}s. Return
191 \retval{values of \VAR{form}s}.
194 \IT{(\MC*{MULTIPLE-VALUE-BIND} (\OPn{\NEV{\VAR{var}}}) \VAR{values-form}
195 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{body-form}})}
197 Evaluate \VAR{body-form}s with \VAR{var}s lexically bound to the
198 return values of \VAR{values-form}. Return \retval{values of
199 \VAR{body-form}s}.
202 \IT{(\MC*{DESTRUCTURING-BIND} \VAR{destruct-$\lambda$} \VAR{bar}
203 \OPn{(\kwd{declare}
204 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
206 Evaluate \VAR{form}s with variables from tree
207 \VAR{destruct-$\lambda$} bound to corresponding elements of tree
208 \VAR{bar}, and return \retval{their
209 values}. \VAR{destruct-$\lambda$} resembles \VAR{macro-$\lambda$}
210 (section \ref{section:Macros}), but without any \kwd{\&environment}
211 clause.
214 \end{LIST}
217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
218 \subsection{Functions}
219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
220 \label{section:Functions}
222 \begin{flushleft}
223 Below, ordinary lambda list (\OPn{\VAR{ord-$\lambda$}}) has the form\\
224 % \VAR{var} referenced from DEFSTRUCT
225 (\OPn{\VAR{var}}
226 \OP{\kwd{\&optional} \xorGOO{%
227 \VAR{var}\\
228 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
229 \penalty-5
230 \Op{\kwd{\&rest} \VAR{var}}
231 \penalty-5
232 \OP{\kwd{\&key} \xorGOO{%
233 \VAR{var}\\
234 (\xorGOO{%
235 \VAR{var}\\
236 (\kwd{:}\VAR{key } \VAR{var})}{\}}
237 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ }\Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
238 \penalty-5
239 \Op{\kwd{\&allow-other-keys}}}
240 \penalty-5
241 \OP{\kwd{\&aux} \xorGOO{%
242 \VAR{var}\\
243 (\VAR{var } \Op{\VAR{init}\DF{\NIL}})}{\}^{\!\!*}}}).
244 \end{flushleft}
245 \VAR{supplied-p} is \T\ if there is a corresponding
246 argument. \VAR{init} forms can refer to any \VAR{init} and
247 \VAR{supplied-p} to their left.
249 \begin{LIST}{1cm}
251 \IT{(\xorGOO{\MC*{DEFUN }\xorGOO{\VAR{foo }(\VAR{\OPn{ord-$\lambda$}})\\
252 (\kwd{setf} \VAR{ foo})\text{ }(\VAR{new-value } \VAR{\OPn{ord-$\lambda$}})}{.}\\
253 \MC*{LAMBDA }(\VAR{\OPn{ord-$\lambda$}})}{\}}
254 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
255 \Op{\NEV{\VAR{doc}}}
256 \PROGN{\VAR{form}})}
258 Define a function named \retval{\VAR{foo}} or \retval{(\kwd{setf}
259 \VAR{foo})}, or an anonymous \retval{function}, respectively, which applies
260 \VAR{form}s to \VAR{ord-$\lambda$}s. For \MC{defun}, \VAR{form}s are
261 enclosed in an implicit \SO{block} named \VAR{foo}.
264 \IT{(\xorGOO{\SO*{FLET}\\
265 \SO*{LABELS}}{\}}
266 (\OPn{(\xorGOO{\VAR{foo }(\OPn{\VAR{ord-$\lambda$}})\\
267 (\kwd{setf} \VAR{ foo})\text{ }(\VAR{new-value }\OPn{\VAR{ord-$\lambda$}})}{\}}
268 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{local-decl}}})}
269 \Op{\NEV{\VAR{doc}}}
270 \PROGN{\VAR{local-form}})}) \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
271 \PROGN{\VAR{form}})}
273 Evaluate \VAR{form}s with
274 locally defined functions \VAR{foo}. Globally defined functions of
275 the same name are shadowed. Each \VAR{foo} is also the name of an
276 implicit \SO{block} around its corresponding \OPn{\VAR{local-form}}.
277 Only for \SO{LABELS}, functions \VAR{foo} are visible inside
278 \VAR{local-forms}. Return \retval{values of \VAR{form}s}.
281 \IT{(\SO*{FUNCTION} \xorGOO{%
282 \VAR{foo}\\
283 (\MC{lambda } \OPn{\VAR{form}})}{\}})}
285 Return lexically innermost \retval{function} named \VAR{foo} or a
286 lexical closure of the \retval{\MC{lambda} expression}.
289 \IT{(\FU*{APPLY} \xorGOO{\VAR{function}\\
290 (\kwd{setf } \VAR{function})}{\}} \OPn{\VAR{arg}} \VAR{args})}
292 \retval{Values of \VAR{function}} called with
293 \VAR{arg}s and the list elements of \VAR{args}. \kwd{setf}able if
294 \VAR{function} is one of \FU{aref}, \FU{bit}, and \FU{sbit}.
297 \IT{(\FU*{FUNCALL} \VAR{function} \OPn{arg})}
299 \retval{Values of \VAR{function}} called with \VAR{arg}s.
302 \IT{(\SO*{MULTIPLE-VALUE-CALL} \VAR{function} \OPn{\VAR{form}})}
304 Call \VAR{function} with all the values of each \VAR{form} as its
305 arguments. Return \retval{values returned by \VAR{function}}.
308 \IT{(\FU*{VALUES-LIST} \VAR{list})}
310 Return \retval{elements of \VAR{list}}.
313 \IT{(\FU*{VALUES} \OPn{\VAR{foo}})}
315 Return as multiple values the \retval{primary values} of the
316 \VAR{foo}s. \kwd{setf}able.
319 \IT{(\FU*{MULTIPLE-VALUE-LIST} \VAR{form})}
321 \retval{List of the values of \VAR{form}}.
324 \IT{(\MC*{NTH-VALUE} \VAR{n} \VAR{form})}
326 Zero-indexed \retval{\VAR{n}th return value} of \VAR{form}.
329 \IT{(\FU*{COMPLEMENT} \VAR{function})}
331 Return \retval{new function} with same arguments and same side effects
332 as \VAR{function}, but with complementary truth value.
335 \IT{(\FU*{CONSTANTLY} \VAR{foo})}
337 \retval{Function} of any number of arguments returning \VAR{foo}.
340 \IT{(\FU*{IDENTITY} \VAR{foo})}
342 Return \retval{\VAR{foo}}.
345 \IT{(\FU*{FUNCTION-LAMBDA-EXPRESSION} \VAR{function})}
347 If available, return \retval{lambda expression} of \VAR{function},
348 \retvalii{\NIL} if \VAR{function} was defined in an environment
349 without bindings, and \retvaliii{name} of \VAR{function}.
352 \IT{(\FU*{FDEFINITION} \xorGOO{\VAR{foo}\\
353 (\kwd{setf } \VAR{foo})}{\}})}
355 \retval{Definition} of global function \VAR{foo}. \kwd{setf}able.
358 \IT{(\FU*{FMAKUNBOUND} \VAR{foo})}
360 Remove global function or macro definition \retval{\VAR{foo}}.
363 \IT{\arrGOO{\CNS*{CALL-ARGUMENTS-LIMIT}\\
364 \CNS*{LAMBDA-PARAMETERS-LIMIT}}{.}}
366 Upper bound of the number of function arguments or lambda list
367 parameters, respectively; $\geq50$.
370 \IT{\CNS*{MULTIPLE-VALUES-LIMIT}}
372 Upper bound of the number of values a multiple value can have;
373 $\geq20$.
376 \end{LIST}
379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
380 \subsection{Macros}
381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
382 \label{section:Macros}
384 \begin{flushleft}
385 Below, macro lambda list (\OPn{\VAR{macro-$\lambda$}}) has the form of
386 either
387 \penalty-5
388 (\Op{\kwd{\&whole} \VAR{var}}
389 \penalty-5
390 \Op{\VAR{E}}
391 \penalty-5
392 \xorGOO{%
393 \VAR{var}\\
394 (\OPn{\VAR{macro-$\lambda$}})}{\}^{\!\!*}}
395 \penalty-5
396 \Op{\VAR{E}}
397 \penalty-5
398 \Op{\kwd{\&optional}
399 \xorGOO{%
400 \VAR{var}\\
401 (\xorGOO{%
402 \VAR{var}\\
403 (\OPn{\VAR{macro-$\lambda$}})}{\}}\text{ }
404 \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
405 \penalty-5
406 \Op{\VAR{E}}
407 \penalty-5
408 \Op{%
409 \xorGOO{%
410 \kwd{\&rest}\\
411 \kwd{\&body}}{\}}
412 \xorGOO{%
413 \VAR{rest-var}\\
414 (\OPn{\VAR{macro-$\lambda$}})}{\}}}
415 \penalty-5
416 \Op{\VAR{E}}
417 \penalty-5
418 \OP{\kwd{\&key}
419 \xorGOO{%
420 \VAR{var}\\
421 (\xorGOO{%
422 \VAR{var}\\
423 (\kwd{:}\VAR{key } \xorGOO{%
424 \VAR{var}\\
425 (\OPn{\VAR{macro-$\lambda$}})}{\}})}{\}}
426 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
427 \Op{\VAR{E}}
428 \Op{\kwd{\&allow-other-keys}}}
429 \penalty-5
430 \Op{\kwd{\&aux}
431 \xorGOO{%
432 \VAR{var}\\
433 (\VAR{var } \Op{\VAR{init}\DF{\NIL}})}{\}^{\!\!*}}}
434 \penalty-5
435 \Op{\VAR{E}})
439 \penalty-5
440 (\Op{\kwd{\&whole}
441 \VAR{var}}
442 \penalty-5
443 \Op{\VAR{E}}
444 \penalty-5
445 \xorGOO{%
446 \VAR{var}\\
447 (\OPn{\VAR{macro-$\lambda$}})}{\}^{\!\!*}}
448 \penalty-5
449 \Op{\VAR{E}}
450 \penalty-5
451 \Op{\kwd{\&optional}
452 \xorGOO{%
453 \VAR{var}\\
454 (\xorGOO{%
455 \VAR{var}\\
456 (\OPn{\VAR{macro-$\lambda$}})}{\}}\text{ }
457 \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
458 \penalty-5
459 \Op{\VAR{E}}
460 \kwd{.}
461 \VAR{rest-var}).
462 \penalty-5
463 \end{flushleft}
464 One toplevel \Op{\VAR{E}} may be replaced by \kwd{\&environment}
465 \VAR{var}. \VAR{supplied-p} is \T\ if there is a corresponding
466 argument. \VAR{init} forms can refer to any \VAR{init} and
467 \VAR{supplied-p} to their left.
469 \begin{LIST}{1cm}
471 \IT{(\xorGOO{\MC*{DEFMACRO}\\
472 \FU*{DEFINE-COMPILER-MACRO}}{\}}
473 \xorGOO{\VAR{foo}\\
474 (\kwd{setf } \VAR{foo})}{\}}
475 (\OPn{\VAR{macro-$\lambda$}})
476 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \Op{\NEV{\VAR{doc}}}
477 \PROGN{\VAR{form}})}
479 Define macro \retval{\VAR{foo}} which on evaluation as (\VAR{foo}
480 \VAR{tree}) applies expanded \VAR{form}s to arguments from
481 \VAR{tree}, which corresponds to \VAR{tree}-shaped
482 \VAR{macro-$\lambda$}s. \VAR{form}s are enclosed in an implicit
483 \SO{block} named \VAR{foo}.
486 \IT{(\MC*{DEFINE-SYMBOL-MACRO} \VAR{foo} \VAR{form})}
488 Define symbol macro \retval{\VAR{foo}} which on evaluation evaluates
489 expanded \VAR{form}.
492 \IT{(\SO*{MACROLET} (\OPn{(\VAR{foo} (\OPn{\VAR{macro-$\lambda$}})
493 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{local-decl}}})}
494 \Op{\NEV{\VAR{doc}}} \PROGN{\VAR{macro-form}})}) \OPn{(\kwd{declare}
495 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
497 Evaluate \retval{\VAR{form}s} with locally defined mutually
498 invisible macros \VAR{foo} which are enclosed in implicit \SO{block}s
499 of the same name.
502 \IT{(\SO*{SYMBOL-MACROLET} (\OPn{(\VAR{foo}
503 \VAR{expansion-form})}) \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
504 \PROGN{\VAR{form}})}
506 Evaluate \retval{\VAR{form}s} with locally defined symbol macros
507 \VAR{foo}.
510 \IT{(\MC*{DEFSETF} \NEV{\VAR{function}} \xorGOO{%
511 \NEV{\VAR{updater}} \text{ } \Op{\NEV{\VAR{doc}}}\\
512 (\OPn{\VAR{setf-$\lambda$}}) \text{ } (\OPn{\VAR{s-var}}) \text{ }
513 \OPn{(\kwd{declare } \OPn{\NEV{\VAR{decl}}})}\text{ }
514 \Op{\NEV{\VAR{doc}}} \text{ } \PROGN{\VAR{form}}}{\}})
515 \penalty-5
516 where defsetf lambda list (\OPn{\VAR{setf-$\lambda$}}) has the form
517 \penalty-5
518 (\OPn{\VAR{var}}
519 \OP{\kwd{\&optional} \xorGOO{%
520 \VAR{var}\\
521 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ } \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
522 \penalty-5
523 \Op{\kwd{\&rest} \VAR{var}}
524 \penalty-5
525 \OP{\kwd{\&key} \xorGOO{%
526 \VAR{var}\\
527 (\xorGOO{%
528 \VAR{var}\\
529 (\kwd{:}\VAR{key } \VAR{var})}{\}}
530 \text{ }\OP{\VAR{init}\DF{\NIL}\text{ }\Op{\VAR{supplied-p}}})}{\}^{\!\!*}}
531 \penalty-5
532 \Op{\kwd{\&allow-other-keys}}}
533 \penalty-5
534 \OP{\kwd{\&environment} \VAR{var}}%
538 Specify how to \kwd{setf} a place accessed by
539 \retval{\VAR{function}}.
540 \EM{Short form:} (\kwd{setf} (\VAR{function} \OPn{\VAR{arg}}) \VAR{value-form}) is
541 replaced by (\VAR{updater} \OPn{\VAR{arg}} \VAR{value-form}); the
542 latter must return \VAR{value-form}.
543 \EM{Long form:} on invocation of (\kwd{setf} (\VAR{function}
544 \OPn{\VAR{arg}}) \VAR{value-form}), \VAR{form}s must expand
545 into code that sets the place accessed where \VAR{setf-$\lambda$}
546 and \OPn{\VAR{s-var}} describe the arguments of \VAR{function} and
547 the value(s) to be stored, respectively; and that returns
548 the value(s) of \OPn{\VAR{s-var}}. \VAR{form}s are enclosed in an
549 implicit \SO{block} named \VAR{function}.
552 \IT{(\MC*{DEFINE-SETF-EXPANDER} \VAR{function}
553 (\OPn{\VAR{macro-$\lambda$}})
554 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \Op{\NEV{\VAR{doc}}}
555 \PROGN{\VAR{form}})}
557 Specify how to \kwd{setf} a place accessed by
558 \retval{\VAR{function}}. On invocation of (\kwd{setf} (\VAR{function}
559 \OPn{\VAR{arg}}) \VAR{value-form}), \OPn{\VAR{form}} must expand
560 into code returning \VAR{arg-vars}, \VAR{args}, \VAR{newval-vars},
561 \VAR{set-form}, and \VAR{get-form} as described with
562 \FU{GET-SETF-EXPANSION} where the elements of macro
563 lambda list \OPn{\VAR{macro-$\lambda$}} are bound to corresponding
564 \VAR{arg}s. \VAR{form}s are enclosed in an implicit \SO{block}
565 named \VAR{function}.
568 \IT{(\FU*{GET-SETF-EXPANSION} \VAR{place} \Op{\VAR{environment}\DF{\NIL}})}
570 Return lists of temporary variables \retval{\VAR{arg-vars}} and of
571 corresponding \retvalii{\VAR{args}} as given with \VAR{place},
572 list \retvaliii{\VAR{\VAR{newval-vars}}} with temporary variables
573 corresponding to the new values, and \retvaln{4}{\VAR{set-form}}
574 and \retvaln{5}{\VAR{get-form}} specifying in terms of \VAR{arg-vars}
575 and \VAR{newval-vars} how to \kwd{setf} and how to read
576 \VAR{place}.
579 \IT{(\MC*{DEFINE-MODIFY-MACRO} \VAR{foo}
580 (\OP{\kwd{\&optional} \xorGOO{%
581 \VAR{var}\\
582 (\VAR{var } \OP{\VAR{init}\DF{\NIL}\text{ }
583 \Op{\VAR{supplied-p}}})}{\}^{\!\!*}}}
584 \Op{\kwd{\&rest} \VAR{var}})
585 \VAR{function} \Op{\NEV{\VAR{doc}}})}
587 Define macro \retval{\VAR{foo}} able to modify a place. On
588 invocation of (\VAR{foo} \VAR{place} \OPn{\VAR{arg}}), the value of
589 \VAR{function} applied to \VAR{place} and \VAR{arg}s will be stored into
590 \VAR{place} and returned.
593 \IT{\CNS*{LAMBDA-LIST-KEYWORDS}}
594 {List of macro lambda list keywords. These are at least:
596 \begin{LIST}{.5cm}
598 \IT{\kwd*{\&whole} \VAR{var}}
599 {Bind \VAR{var} to the entire macro call form.}
601 \IT{\kwd*{\&optional} \OPn{\VAR{var}}}
602 {Bind \VAR{var}s to corresponding arguments if any.}
604 \IT{\Goo{%
605 \kwd*{\&rest}\XOR
606 \kwd*{\&body}} \VAR{var}}
607 {Bind \VAR{var} to a list of remaining arguments.}
609 \IT{\kwd*{\&key} \OPn{\VAR{var}}}
610 {Bind \VAR{var}s to corresponding keyword arguments.}
612 \IT{\kwd*{\&allow-other-keys}}
614 Suppress keyword argument checking. Callers can do so using
615 \kwd*{:allow-other-keys}~\T.
618 \IT{\kwd*{\&environment} \VAR{var}}
619 {Bind \VAR{var} to the lexical compilation environment.}
621 \IT{\kwd*{\&aux} \OPn{\VAR{var}}}
622 {Bind \VAR{var}s as in \SO{let\A}.}
624 \end{LIST}
625 \end{LIST}
628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629 \subsection{Control Flow}
630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
631 \begin{LIST}{1cm}
633 \IT{(\SO*{IF} \VAR{test} \VAR{then} \Op{\VAR{else}\DF{\NIL}})}
635 Return values of \retval{\VAR{then}} if \VAR{test} returns \T;
636 return values of \retval{\VAR{else}} otherwise.
639 \IT{(\MC*{COND} \OPn{(\VAR{test} \PROGN{\VAR{then}}\DF{\VAR{test}})})}
641 Return the \retval{values} of the first \OPn{\VAR{then}} whose
642 \VAR{test} returns \T; return \retval{\NIL} if all \VAR{test}s
643 return \NIL.
646 \IT{(\xorGOO{\MC*{WHEN}\\
647 \MC*{UNLESS}}{\}} \VAR{test}
648 \PROGN{\VAR{foo}})}
650 Evaluate \VAR{foo}s and return \retval{their values} if \VAR{test}
651 returns \T\ or \NIL, respectively. Return \retval{\NIL} otherwise.
654 \IT{(\MC*{CASE} \VAR{test} \OPn{(\xorGOO{(\OPn{\NEV{\VAR{key}}})\\
655 \NEV{\VAR{key}}}{\}} \PROGN{\VAR{foo}})}
656 \OP{(\xorGOO{\kwd*{OTHERWISE}\\
657 \T}{\}} \PROGN{\VAR{bar}})\DF{\NIL}})}
659 Return the \retval{values} of the first \OPn{\VAR{foo}} one of
660 whose \VAR{key}s is \kwd{eql} \VAR{test}. Return \retval{values of
661 \VAR{bar}s} if there is no matching \VAR{key}.
664 \IT{(\xorGOO{\MC*{ECASE}\\
665 \MC*{CCASE}}{\}} \VAR{test}
666 \OPn{(\xorGOO{(\OPn{\NEV{\VAR{key}}})\\
667 \NEV{\VAR{key}}}{\}} \PROGN{\VAR{foo}})})}
669 Return the \retval{values} of the first \OPn{\VAR{foo}} one of
670 whose \VAR{key}s is \kwd{eql} \VAR{test}. Signal
671 non-correctable/correctable \kwd{type-error} if there is no
672 matching \VAR{key}.
675 \IT{(\MC*{AND} \OPn{\VAR{form}}\DF{\T})}
677 Evaluate \VAR{form}s from left to right. Immediately return
678 \retval{\NIL} if one \VAR{form}'s value is \NIL. Return
679 \retval{values of last \VAR{form}} otherwise.
682 \IT{(\MC*{OR} \OPn{\VAR{form}}\DF{\NIL})}
684 Evaluate \VAR{form}s from left to
685 right. Immediately return \retval{primary value} of first
686 non-\NIL-evaluating form, or \retval{all values} if last \VAR{form}
687 is reached. Return \retval{\NIL} if no \VAR{form} returns \T.
690 \IT{(\SO*{PROGN} \OPn{\VAR{form}}\DF{\NIL})}
691 {\label{:progn}
692 Evaluate \VAR{form}s sequentially. Return
693 \retval{values of last \VAR{form}}.
696 \IT{\arrGOO{%
697 (\SO*{MULTIPLE-VALUE-PROG1} \VAR{ form-r} \OPn{\VAR{ form}})\\
698 (\MC*{PROG1} \VAR{ form-r} \OPn{\VAR{ form}})\\
699 (\MC*{PROG2} \VAR{ form-a} \VAR{ form-r} \OPn{\VAR{ form}})}{.}}
701 Evaluate forms in order. Return \retval{values/primary value},
702 respectively, of \VAR{form-r}.
705 \IT{(\xorGOO{\MC*{PROG}\\
706 \MC*{PROG\A}}{\}}
707 (\orGOO{%
708 \VAR{name}\\
709 (\VAR{name } \Op{\VAR{value}\DF{\NIL}})}{\}^{\!\!*}})
710 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
711 \xorGOO{\NEV{\VAR{tag}}\\\VAR{form}}{\}^{\!\!*}})}
713 Evaluate \SO{TAGBODY}-like body with \VAR{name}s lexically bound (in
714 parallel or sequentially, respectively) to \VAR{value}s. Return
715 \retval{\NIL} or explicitly \retval{\MC{return}ed values}.
716 Implicitly, the whole form is a \SO{block} named \NIL.
719 \IT{(\SO*{UNWIND-PROTECT} \VAR{protected} \OPn{\VAR{cleanup}})}
721 Evaluate \VAR{protected} and then, no matter how control leaves
722 \VAR{protected}, \VAR{cleanup}s. Return \retval{values of
723 \VAR{protected}}.
726 \IT{(\SO*{BLOCK} \VAR{name} \PROGN{\VAR{form}})}
728 Evaluate \VAR{form}s in a lexical environment, and
729 return \retval{their values} unless interrupted by
730 \SO{RETURN-FROM}.
733 \IT{\arrGOO{(\SO*{RETURN-FROM } \VAR{foo } \Op{\VAR{result}\DF{\NIL}})\\
734 (\MC*{RETURN } \Op{\VAR{result}\DF{\NIL}})}{.}}
736 Have nearest enclosing \SO{block} named \VAR{foo}/named \NIL,
737 respectively, return with values of \VAR{result}.
740 \IT{(\SO*{TAGBODY} \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
742 Evaluate \VAR{form}s in a lexical environment. \VAR{tag}s (symbols
743 or integers) have lexical scope and dynamic extent, and are
744 targets for \SO{GO}. Return \retval{\NIL}.
747 \IT{(\SO*{GO} \NEV{\VAR{tag}})}
749 Within the innermost possible enclosing \SO{tagbody}, jump to a
750 tag \FU{eql} \VAR{tag}.
753 \IT{(\SO*{CATCH} \VAR{tag} \PROGN{\VAR{form}})}
755 Evaluate \VAR{form}s and return \retval{their values} unless
756 interrupted by \SO{THROW}.
759 \IT{(\SO*{THROW} \VAR{tag} \VAR{form})}
761 Have the nearest dynamically
762 enclosing \SO{CATCH} with a tag \FU{eq} \VAR{tag} return with the
763 values of \VAR{form}.
766 \IT{(\FU*{SLEEP} \VAR{n})}
768 Wait \VAR{n} seconds; return \retval{\NIL}.
771 \end{LIST}
774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
775 \subsection{Iteration}
776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
778 \begin{LIST}{1cm}
780 \IT{(\xorGOO{\MC*{DO}\\
781 \MC*{DO\A}}{\}}
782 (\xorGOO{%
783 \VAR{var}\\
784 (\VAR{var } \OP{ \VAR{start } \Op{\VAR{step}}})}{\}^{\!\!*}})
785 (\VAR{stop} \PROGN{\VAR{result}})
786 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
787 \xorGOO{\NEV{\VAR{tag}}\\\VAR{form}}{\}^{\!\!*}})}
789 Evaluate \SO{TAGBODY}-like body with \VAR{var}s successively bound
790 according to the values of the corresponding \VAR{start} and
791 \VAR{step} forms. \VAR{var}s are bound in parallel/sequentially,
792 respectively. Stop iteration when \VAR{stop} is \T. Return
793 \retval{values of \OPn{\VAR{result}}}. Implicitly, the whole form
794 is a \SO{block} named \NIL.
797 \IT{(\MC*{DOTIMES} (\VAR{var} \VAR{i} \Op{\VAR{result}\DF{\NIL}})
798 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
799 \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
801 Evaluate \SO{TAGBODY}-like body with \VAR{var} successively bound
802 to integers from 0 to $i - 1$. Upon evaluation of
803 \retval{\VAR{result}}, \VAR{var} is \VAR{i}. Implicitly, the whole
804 form is a \SO{block} named \NIL.
807 \IT{(\MC*{DOLIST }(\VAR{var} \VAR{list} \Op{\VAR{result}\DF{\NIL}})
808 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
809 \Goos{\NEV{\VAR{tag}}\XOR\VAR{form}})}
811 Evaluate \SO{TAGBODY}-like body with \VAR{var} successively bound
812 to the elements of \VAR{list}. Upon evaluation of
813 \retval{\VAR{result}}, \VAR{var} is \NIL. Implicitly, the whole form
814 is a \SO{block} named \NIL.
818 \end{LIST}
820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
821 \subsection{Loop Facility}
822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
823 \label{section:Loop Facility}
825 \begin{LIST}{1cm}
827 \IT{(\MC*{LOOP} \OPn{\VAR{form}})}
829 \EM{Simple Loop. } If \VAR{form}s do not contain any atomic Loop
830 Facility keywords, evaluate them forever in an implicit \SO{block}
831 named \NIL.
834 \IT{(\MC*{LOOP} \OPn{\VAR{clause}})}
836 \EM{Loop Facility. } For Loop Facility keywords
837 see below and Figure \ref{loop-overview}.
840 \begin{LIST}{.5cm}
842 \IT{\LKWD*{named} \VAR{n}\DF{\NIL}}
844 Give \MC{loop}'s implicit \SO{block} a name.
847 \IT{\Goop{\LKWD*{with}
848 \xorGOO{%
849 \VAR{var-s}\\
850 (\OPn{\VAR{var-s}})}{\}}
851 \Op{\VAR{d-type}}
852 \Op{\LKWD*{=} \VAR{foo}}}
853 \Goos{\LKWD*{and}
854 \xorGOO{%
855 \VAR{var-p}\\
856 (\OPn{\VAR{var-p}})}{\}}
857 \Op{\VAR{d-type}}
858 \Op{\LKWD*{=} \VAR{bar}}}
859 \penalty-10
860 where destructuring type specifier \VAR{d-type} has the form
861 \penalty-5
862 \GOO{\kwd{fixnum}\XOR
863 \kwd{float}\XOR
864 \T\XOR
865 \NIL\XOR
866 \GOo{%
867 \LKWD*{of-type}
868 \xorGOO{\VAR{type}\\
869 (\OPn{\VAR{type}})}{\}}}}
872 Initialize (possibly trees of) local variables \VAR{var-s}
873 sequentially and \VAR{var-p} in parallel.
876 \begin{figure}%
877 \begin{center}%
878 \begin{sideways}%
880 \arraycolsep0pt
882 \text{\kwd{loop}}\text{ }
883 \Op{
884 \text{\LKWD{named} \VAR{n}\DF{\NIL}}
886 \left\{
887 \begin{array}{l}
888 \text{\LKWD{with}
889 \xorGOO{%
890 \VAR{var}\\
891 (\OPn{\VAR{var}})}{\}}
892 \Op{\VAR{d-type}}
893 \Op{\LKWD{=} \VAR{foo}}}
894 \text{ }
895 \{\text{\LKWD{and}
896 \xorGOO{%
897 \VAR{var}\\
898 (\OPn{\VAR{var}})}{\}}
899 \Op{\VAR{d-type}}
900 \Op{\LKWD{=} \VAR{bar}}}\}^{*} \\ \\[-2.4ex]
901 \left.\!
902 \begin{array}{l}
903 \text{\LKWD{for}} \\
904 \text{\LKWD{as}}
905 \end{array}\right\}
906 \boxed{
907 \text{\xorGOO{%
908 \VAR{var}\\
909 (\OPn{\VAR{var}})}{\}}}%
910 \Op{\VAR{d-type}}
911 \left\{
912 \begin{array}{l}
913 \left.\!
914 \begin{array}{l}
915 \OP{
916 \left\{
917 \begin{array}{l}
918 \text{\LKWD{upfrom}}\\
919 \text{\LKWD{from}}
920 \end{array}
921 \right\}
922 \text{\VAR{start}\DF{\LIT{0}}}
923 }\text{ }
924 \OP{
925 \left\{
926 \begin{array}{l}
927 \text{\LKWD{upto}}\\
928 \text{\LKWD{to}}\\
929 \text{\LKWD{below}}
930 \end{array}
931 \right\}
932 \text{\VAR{form}}
934 \text{\LKWD{from} \VAR{start}}
935 \left\{
936 \begin{array}{l}
937 \text{\LKWD{downto}}\\
938 \text{\LKWD{above}}
939 \end{array}
940 \right\}
941 \text{\VAR{form }}\\
942 \text{\LKWD{downfrom} \VAR{start}}\text{ }
943 \OP{
944 \left\{
945 \begin{array}{l}
946 \text{\LKWD{downto}}\\
947 \text{\LKWD{to}}\\
948 \text{\LKWD{above}}
949 \end{array}
950 \right\}
951 \text{\VAR{form}}
953 \end{array}
954 \right\}
955 \Op{
956 \text{\LKWD{by} \VAR{step}\DF{\LIT{1}}}
958 \left.\!
959 \begin{array}{l}
960 \text{\LKWD{in}} \\
961 \text{\LKWD{on}}
962 \end{array}
963 \right\}
964 \text{\VAR{list}}\text{ }
965 \Op{
966 \text{\LKWD{by} \VAR{function}\DF{\kwd{\#'cdr}}}
968 \text{\LKWD{=} \VAR{foo }}
969 \Op{
970 \text{\LKWD{then} \VAR{bar}\DF{\VAR{foo}}}
972 \text{\LKWD{across} \VAR{vector}}\\
973 \text{\LKWD{being}}
974 \left\{
975 \begin{array}{l}
976 \text{\LKWD{the}}\\
977 \text{\LKWD{each}}
978 \end{array}
979 \right\}%
980 \left\{
981 \begin{array}{{l}}
982 \left.\!
983 \begin{array}{l}
984 \text{\LKWD{hash-key\Op{s}}}
985 \left\{
986 \begin{array}{l}
987 \text{\LKWD{of}}\\
988 \text{\LKWD{in}}
989 \end{array}
990 \right\}
991 \text{\VAR{hash }}
992 \Op{
993 \text{\LKWD{using} (\LKWD{hash-value} \VAR{v})}%
995 \text{\LKWD{hash-value\Op{s}}}
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 \text{\LKWD{do\Op{ing}}}
1043 \text{ \VAR{form}}^{+}\\
1044 \left.\!
1045 \begin{array}{l}
1046 \text{\LKWD{if}}\\
1047 \text{\LKWD{when}}\\
1048 \text{\LKWD{unless}}
1049 \end{array}
1050 \right\}%
1051 \text{\VAR{test }}
1052 \boxed{\mathbb{C}_i\!}\{\text{\LKWD{and}}\,
1053 \boxed{\mathbb{C}_j\!}\}^{*}\Op{\text{\LKWD{else}}\,
1054 \boxed{\mathbb{C}_k\!}\{\text{\LKWD{and}}\,
1055 \boxed{\mathbb{C}_l\!}\}^{*}}
1056 \Op{\text{\LKWD{end}}}\!\!\!\!\!\!\!\\
1057 \text{\LKWD{return}}
1058 \left\{
1059 \begin{array}{l}
1060 \text{\VAR{form}}\\
1061 \text{\LKWD{it}}
1062 \end{array}
1063 \right.\\
1064 \left.\!
1065 \begin{array}{l}
1066 \text{\LKWD{collect\Op{ing}}}\\
1067 \text{\LKWD{append\Op{ing}}}\\
1068 \text{\LKWD{nconc\Op{ing}}}
1069 \end{array}
1070 \right\}
1071 \left\{
1072 \begin{array}{l}
1073 \text{\VAR{form}}\\
1074 \text{\LKWD{it}}
1075 \end{array}
1076 \right\} \Op{\text{\LKWD{into }\VAR{list}}}\\
1077 \left.\!
1078 \begin{array}{l}
1079 \text{\LKWD{count\Op{ing}}}\\
1080 \text{\LKWD{sum\Op{ming}}}\\
1081 \text{\LKWD{maximize}}\\
1082 \text{\LKWD{maximizing}}\\
1083 \text{\LKWD{minimize}}\\
1084 \text{\LKWD{minimizing}}
1085 \end{array}
1086 \right\}
1087 \left\{
1088 \begin{array}{l}
1089 \text{\VAR{form}}\\
1090 \text{\LKWD{it}}
1091 \end{array}
1092 \right\}
1093 \Op{\text{\LKWD{into }\VAR{num}}}\text{ }
1094 \Op{\text{\VAR{type}}}
1095 \end{array}
1096 \right._{{}^{{}^{\!\!\!\!\displaystyle{\mathbb{C}_0}}}}
1097 }%boxed
1099 \\[-2.4ex]
1100 \boxed{
1101 \left.\!
1102 \begin{array}{l}
1103 \left.\!
1104 \begin{array}{l}
1105 \text{\LKWD{initially}} \\
1106 \text{\LKWD{finally}}
1107 \end{array}
1108 \right\}
1109 \text{\VAR{form}}^{+}\\
1110 \text{\LKWD{repeat} \VAR{num}}\\
1111 \left.\!
1112 \begin{array}{l}
1113 \text{\LKWD{while}}\\
1114 \text{\LKWD{until}}\\
1115 \text{\LKWD{always}}\\
1116 \text{\LKWD{never}}\\
1117 \text{\LKWD{thereis}}
1118 \end{array}
1119 \right\}
1120 \text{\VAR{test}}
1121 \end{array}
1122 \right._{{}^{{}^{\displaystyle{\mathbb{T}_2}}}}
1123 }%boxed
1124 \end{array}
1125 \right\}^{\displaystyle{\!\!*}}
1127 \!)%
1128 \end{sideways}%
1129 \end{center}%
1130 \vspace{-3em}
1131 \raisebox{0em}[0em][0em]{\parbox[b]{4cm}{\caption{\protect\raggedright Loop Facility, Overview.\label{loop-overview}}}}
1132 \end{figure}
1134 \IT{\GOop{\Goo{\LKWD*{for}\XOR\LKWD*{as}}
1135 \xorGOO{%
1136 \VAR{var-s}\\
1137 (\OPn{\VAR{var-s}})}{\}}
1138 \Op{\VAR{d-type}}}
1139 \GOos{\LKWD*{and}
1140 \xorGOO{%
1141 \VAR{var-p}\\
1142 (\OPn{\VAR{var-p}})}{\}}
1143 \Op{\VAR{d-type}}}}
1145 Begin of iteration control clauses. Initialize and step (possibly
1146 trees of) local variables \VAR{var-s} sequentially and \VAR{var-p}
1147 in parallel. Destructuring type specifier \VAR{d-type} as with
1148 \LKWD{with}.
1151 \begin{LIST}{.5cm}
1153 \IT{\Goo{\LKWD*{upfrom}\XOR\LKWD*{from}\XOR\LKWD*{downfrom}}
1154 \VAR{start}}
1156 Start stepping with \VAR{start}
1159 \IT{\Goo{\LKWD*{upto}\XOR\LKWD*{downto}\XOR\LKWD*{to}\XOR\LKWD*{below}\XOR\LKWD*{above}}
1160 \VAR{form}}
1162 Specify \VAR{form} as the end value for stepping.
1165 \IT{\Goo{\LKWD*{in}\XOR\LKWD*{on}} \VAR{list}}
1167 Bind \VAR{var} to successive elements/tails, respectively, of
1168 \VAR{list}.
1171 \IT{\LKWD*{by} \Goo{\VAR{step}\DF{\LIT{1}}\XOR\VAR{function}\DF{\kwd{\#'cdr}}}}
1173 Specify the (positive) decrement or increment or the
1174 \VAR{function} of one argument returning the next part of the
1175 list.
1178 \IT{\LKWD*{=} \VAR{foo} \Op{\LKWD*{then}
1179 \VAR{bar}\DF{\VAR{foo}}}}
1181 Bind \VAR{var} initially to \VAR{foo} and later to
1182 \VAR{bar}.
1185 \IT{\LKWD*{across} \VAR{vector}}
1187 Bind \VAR{var} to successive elements of \VAR{vector}.
1190 \IT{\LKWD*{being} \Goo{\LKWD*{the}\XOR\LKWD*{each}}}
1192 Iterate over a hash table or a package.
1195 \begin{LIST}{.5cm}
1197 \IT{\Goo{\LKWD*{hash-key}\XOR\LKWD*{hash-keys}}
1198 \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};
1202 bind \VAR{value} to corresponding values.
1205 \IT{\Goo{\LKWD*{hash-value}\XOR\LKWD*{hash-values}}
1206 \Goo{\LKWD*{of}\XOR\LKWD*{in}} \VAR{hash-table}
1207 \Op{\LKWD*{using} (\LKWD*{hash-key} \VAR{key})}}
1209 Bind \VAR{var} successively to the values of
1210 \VAR{hash-table}; bind \VAR{key} to corresponding keys.
1213 \IT{\Goo{\LKWD*{symbol}\XOR\LKWD*{symbols}\XOR\LKWD*{present-symbol}\XOR\LKWD*{present-symbols}\XOR\LKWD*{external-symbol}\XOR\LKWD*{external-symbols}}
1214 \Op{\Goo{\LKWD*{of}\XOR\LKWD*{in}}
1215 \VAR{package}\DF{\V{\A package\A}}}}
1217 Bind \VAR{var} successively to the accessible symbols, or
1218 the present symbols, or the external symbols respectively,
1219 of \VAR{package}.
1222 \end{LIST}
1223 \end{LIST}
1225 \IT{\Goo{\LKWD*{do}\XOR\LKWD*{doing}} \RP{\VAR{form}}}
1227 Evaluate \VAR{form}s in every iteration.
1230 \IT{\Goo{\LKWD*{if}\XOR\LKWD*{when}\XOR\LKWD*{unless}} \VAR{ test}
1231 \VAR{i-clause} \Goos{\LKWD*{and}
1232 \VAR{j-clause}} \Op{\LKWD*{else} \VAR{k-clause} \Goos{\LKWD*{and}
1233 \VAR{l-clause}}} \Op{\LKWD*{end}}}
1235 If \VAR{test} returns \T, \T, or \NIL, respectively, evaluate
1236 \VAR{i-clause} and \VAR{j-clause}s; otherwise, evaluate
1237 \VAR{k-clause} and \VAR{l-clause}s.
1240 \begin{LIST}{.5cm}
1241 \IT{\LKWD*{it}}
1243 Inside \VAR{i-clause} or \VAR{k-clause}:
1244 \retval{value of \VAR{test}}.
1246 \end{LIST}
1248 \IT{\LKWD*{return} \Goo{\VAR{form}\XOR\LKWD*{it}}}
1250 Return immediately, skipping any \LKWD{finally} parts, with
1251 values of \VAR{form} or \LKWD{it}.
1254 \IT{\Goo{\LKWD*{collect}\XOR\LKWD*{collecting}}
1255 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into} \VAR{list}}}
1257 Collect values of \VAR{form} or \LKWD{it} into \VAR{list}. If no
1258 \VAR{list} is given, collect into an anonymous list which is
1259 returned after termination.
1262 \IT{\Goo{\LKWD*{append}\XOR\LKWD*{appending}\XOR\LKWD*{nconc}\XOR\LKWD*{nconcing}}
1263 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1264 \VAR{list}}}
1266 Concatenate values of \VAR{form} or \LKWD{it}, which should be
1267 lists, into \VAR{list} by the means of \FU{append} or \FU{nconc},
1268 respectively. If no \VAR{list} is given, collect into an
1269 anonymous list which is returned after termination.
1272 \IT{\Goo{\LKWD*{count}\XOR\LKWD*{counting}}
1273 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1274 \VAR{n}} \Op{\VAR{type}}}
1276 Count the number of times the value of \VAR{form} or of \LKWD{it} is \T.
1277 If no \VAR{n} is given, count into an anonymous variable
1278 which is returned after termination.
1281 \IT{\Goo{\LKWD*{sum}\XOR\LKWD*{summing}}
1282 \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1283 \VAR{sum}} \Op{\VAR{type}}}
1285 Calculate the sum of the primary values of \VAR{form} or of \LKWD{it}.
1286 If no \VAR{sum} is given, sum into an anonymous variable
1287 which is returned after termination.
1290 \IT{\Goo{\LKWD*{maximize}\XOR\LKWD*{maximizing}\XOR
1291 \LKWD*{minimize}\XOR
1292 \LKWD*{minimizing}} \Goo{\VAR{form}\XOR\LKWD*{it}} \Op{\LKWD*{into}
1293 \VAR{max-min}} \Op{\VAR{type}}}
1295 Determine the maximum or minimum, respectively, of the primary values of
1296 \VAR{form} or of \LKWD{it}.
1297 If no \VAR{max-min} is given, use an anonymous variable
1298 which is returned after termination.
1301 \IT{\Goo{\LKWD*{initially}\XOR\LKWD*{finally}} \RP{\VAR{form}}}
1303 Evaluate \VAR{form}s before begin, or after end, respectively,
1304 of iterations.
1307 \IT{\LKWD*{repeat} \VAR{num}}
1309 Terminate \MC{loop} after \VAR{num} iterations; \VAR{num} is
1310 evaluated once.
1313 \IT{\Goo{\LKWD*{while}\XOR\LKWD*{until}} \VAR{test}}
1315 Continue iteration until \VAR{test} returns \NIL\ or \T,
1316 respectively.
1319 \IT{\Goo{\LKWD*{always}\XOR\LKWD*{never}} \VAR{test}}
1321 Terminate \MC{loop} returning \NIL\ and skipping any
1322 \LKWD{finally} parts as soon as \VAR{test} is \NIL\ or \T,
1323 respectively. Otherwise continue \MC{loop} with its default
1324 return value set to \T.
1327 \IT{\LKWD*{thereis} \VAR{test}}
1329 Terminate \MC{loop} when \VAR{test} is \T\ and return value of
1330 \VAR{test}, skipping any \LKWD{finally} parts. Otherwise
1331 continue \MC{loop} with its default return value set to \NIL.
1334 \IT{(\MC*{loop-finish})}
1336 Terminate \MC{loop} immediately executing any \LKWD{finally}
1337 clauses and returning any accumulated results.
1339 \end{LIST}
1340 \end{LIST}
1345 % LocalWords: pt
1347 %%% Local Variables:
1348 %%% mode: latex
1349 %%% TeX-master: "clqr"
1350 %%% End: