mostly minor fixes, from F to O in index; destructuring vars and types in loop; page...
[clqr.git] / clqr-structures.tex
blob81cdf190bcb04c3778f17a16338b3b7a81080638
1 % Copyright (C) 2008 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{Structures}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 \begin{LIST}{1cm}
16 \IT{(\FU*{SLOT-EXISTS-P} \VAR{foo} \VAR{bar})}
18 \retval{\T} if \VAR{foo} has a slot \VAR{bar}.
21 \IT{(\MC*{DEFSTRUCT}
22 \GOO{\VAR{foo}\XOR
23 (\VAR{foo}
24 \orGOO{%
25 \xorGOO{%
26 \kwd{:conc-name}\\
27 (\kwd{:conc-name } \Op{\NEV{\VAR{slot-prefix}}\DF{\VAR{foo}\LIT{-}}})}{.}\\
28 \xorGOO{%
29 \kwd{:constructor}\\
30 (\kwd{:constructor }
31 \OP{\NEV{\VAR{maker}}\DF{\LIT{MAKE-}\VAR{foo}}\text{ }
32 \Op{({\OPn{\NEV{\VAR{ord-$\lambda$}}}})}})}{\}^{\!\!*}}\\
33 \xorGOO{%
34 \kwd{:copier}\\
35 (\kwd{:copier }
36 \Op{\NEV{\VAR{copier}}\DF{\LIT{COPY-}\VAR{foo}}})}{.}\\
37 (\kwd{:include } \NEV{\VAR{struct}}\text{ }
38 \xorGOO{%
39 \NEV{\VAR{slot}}\\
40 (\NEV{\VAR{slot}}\text{ } \Op{\VAR{init}\text{ }
41 \orGOO{
42 \kwd{:type } \NEV{\VAR{type}}\\
43 \kwd{:read-only } \NEV{\VAR{bool}}}{\}}})\\
44 }{\}^{\!\!*}})\\
45 \xorGOO{
46 (\kwd{:type } \xorGOO{\kwd{list}\\
47 \kwd{vector}\\
48 (\kwd{vector }\NEV{\VAR{size}})}{\}})\text{ }
49 \orGOO{%
50 \kwd{:named}\\
51 (\kwd{:initial-offset } \NEV{\VAR{n}})\\
52 }{.}\\
53 \xorGOO{
54 (\kwd{:print-object } \Op{\NEV{\VAR{o-printer}}})\\
55 (\kwd{:print-function } \Op{\NEV{\VAR{f-printer}}})
56 }{.}
57 }{.}\\
58 \xorGOO{%
59 \kwd{:predicate}\\
60 (\kwd{:predicate } \Op{\NEV{\VAR{p-name}}\DF{\VAR{foo}\LIT{-P}}})}{.}
61 }{\}}%
64 \Op{\NEV{\VAR{doc}}}
65 \xorGOO{
66 \VAR{slot}\\
67 (\VAR{slot } \Op{\VAR{init}\text{ }
68 \orGOO{
69 \kwd{:type } \NEV{\VAR{type}}\\
70 \kwd{:read-only } \NEV{\VAR{bool}}
71 }{\}}})
72 }{\}^{\!\!*}}%
75 Define structure type \retval{\VAR{foo}} together with functions
76 \LIT{MAKE-}\VAR{foo}, \LIT{COPY-}\VAR{foo} and (unless \kwd{:type}
77 without \kwd{:named} is used)
78 \VAR{foo}\LIT{-P}; and \kwd{setf}able accessors
79 \VAR{foo}\LIT{-}\VAR{slot}. Instances of type \VAR{foo} can be
80 created by (\LIT{MAKE-}\VAR{foo} \Goos{\kwd{:}\VAR{slot}
81 \VAR{value}}) or, if \VAR{ord-$\lambda$} (see
82 p.\ \pageref{section:Functions}) is given, by (\VAR{maker}
83 \OPn{\VAR{arg}} \Goos{\kwd{:}\VAR{key} \VAR{value}}). In the latter
84 case, \VAR{arg}s and \kwd{:}\VAR{key}s correspond to the positional
85 and keyword parameters defined in \VAR{ord-$\lambda$} whose \VAR{var}s
86 in turn correspond to \VAR{slot}s.
87 \kwd{:print-object}/\kwd{:print-function} generate a
88 \GFU{print-object} method for an instance \VAR{bar} of \VAR{foo}
89 calling (\VAR{o-printer} \VAR{bar} \VAR{stream}) or (\VAR{f-printer}
90 \VAR{bar} \VAR{stream} \VAR{print-level}), respectively.
93 \IT{(\FU*{COPY-STRUCTURE} \VAR{structure})}
95 Return \retval{copy of \VAR{structure}} with shared slot values.
98 \end{LIST}