Unfinished work on figure Data Types.
[clqr.git] / clqr-arrays.tex
blob5f8f3311335d35af7aa6ca30e93b839adf1aa04b
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{Arrays}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 \label{section:Arrays}
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16 \subsection{Predicates}
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 \begin{LIST}{1cm}
20 \IT{\arrGOO{%
21 (\FU*{ARRAYP} \VAR{ foo})\\
22 (\FU*{VECTORP} \VAR{ foo})\\
23 (\FU*{SIMPLE-VECTOR-P} \VAR{ foo})\\
24 (\FU*{BIT-VECTOR-P} \VAR{ foo})\\
25 (\FU*{SIMPLE-BIT-VECTOR-P} \VAR{ foo})}{.}}
27 \retval{\T} if \VAR{foo} is of indicated type.
30 \IT{\arrGOO{(\FU*{ADJUSTABLE-ARRAY-P} \VAR{ array})\\
31 (\FU*{ARRAY-HAS-FILL-POINTER-P} \VAR{ array})}{.}}
33 Return \retval{\T} if \VAR{array} is adjustable/has a fill pointer,
34 respectively.
37 \IT{(\FU*{ARRAY-IN-BOUNDS-P} \VAR{array} \Op{\VAR{subscripts}})}
39 Return \retval{\T} if \VAR{subscripts} are in \VAR{array}'s bounds.
41 % No default subscripts in standard.
43 \end{LIST}
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 \subsection{Array Functions}
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49 \begin{LIST}{1cm}
51 \IT{(\xorGOO{\FU*{MAKE-ARRAY}\VAR{ dimension-sizes }
52 \OP{\kwd{:adjustable} \VAR{ bool}\DF{\NIL}}\\
53 \FU*{ADJUST-ARRAY } \DES{\VAR{array}}
54 \VAR{ dimension-sizes}}{\}}
55 \orGOO{\kwd{:element-type} \VAR{ type}\DF{\T}\\
56 \kwd{:fill-pointer } \Goo{\VAR{num}\XOR\VAR{bool}}\DF{\NIL}\\
57 \xorGOO{\kwd{:initial-element} \VAR{ obj}\\
58 \kwd{:initial-contents} \VAR{ sequence}\\
59 \kwd{:displaced-to } \VAR{array}\DF{\NIL}\text{ }
60 \Op{\kwd{:displaced-index-offset } \VAR{i}\DF{\LIT{0}}}}{.}}{\}})}
62 Return fresh, or readjust, respectively, \retval{vector} or \retval{array}.
65 \IT{(\FU*{AREF} \VAR{array} \OP{\VAR{subscripts}})}
67 Return
68 \retval{array element} pointed to by \VAR{subscripts}. \kwd{setf}able.
70 % No subscripts means sole element of rank zero array.
72 \IT{(\FU*{ROW-MAJOR-AREF} \VAR{array} \VAR{i})}
74 Return \retval{\VAR{i}th element} of \VAR{array} in row-major
75 order. \kwd{setf}able.
78 \IT{(\FU*{ARRAY-ROW-MAJOR-INDEX} \VAR{array} \Op{\VAR{subscripts}})}
80 \retval{Index} in row-major order of the element denoted by \VAR{subscripts}.
83 \IT{(\FU*{ARRAY-DIMENSIONS} \VAR{array})}
85 \retval{List} containing the lengths of \VAR{array}'s dimensions.
88 \IT{(\FU*{ARRAY-DIMENSION} \VAR{array} \VAR{i})}
90 \retval{Length of \VAR{i}th dimension} of \VAR{array}.
93 \IT{(\FU*{ARRAY-TOTAL-SIZE} \VAR{array})}
95 \retval{Number of elements} in \VAR{array}.
98 \IT{(\FU*{ARRAY-RANK} \VAR{array})}
100 \retval{Number of dimensions} of \VAR{array}.
103 \IT{(\FU*{ARRAY-DISPLACEMENT} \VAR{array})}
105 \retval{Target array} and \retvalii{offset}.
108 \IT{\arrGOO{(\FU*{BIT} \VAR{ bit-array } \Op{\VAR{subscripts}})\\
109 (\FU*{SBIT} \VAR{ simple-bit-array } \Op{\VAR{subscripts}})}{.}}
111 Return \retval{element} of \VAR{bit-array} or of
112 \VAR{simple-bit-array}. \kwd{setf}\-able.
115 \IT{(\FU*{BIT-NOT} \DES{\VAR{bit-array}} \Op{\DES{\VAR{result-bit-array}}\DF{\NIL}})}
117 Return \retval{result} of bitwise negation of \VAR{bit-array}. If \VAR{result-bit-array} is \T, put
118 result in \VAR{bit-array}; if it is \NIL, make a new array for
119 result.
122 \IT{(\xorGOO{%
123 \FU*{BIT-EQV}\\
124 \FU*{BIT-AND}\\
125 \FU*{BIT-ANDC1}\\
126 \FU*{BIT-ANDC2}\\
127 \FU*{BIT-NAND}\\
128 \FU*{BIT-IOR}\\
129 \FU*{BIT-ORC1}\\
130 \FU*{BIT-ORC2}\\
131 \FU*{BIT-XOR}\\
132 \FU*{BIT-NOR}}{\}} \DES{\VAR{bit-array-a}} \VAR{bit-array-b}
133 \Op{\DES{\VAR{result-bit-array}}\DF{\NIL}})}
135 Return \retval{result} of bitwise logical operations
136 (cf.\ operations of \FU{boole}, p.\ \pageref{section:Logic Functions}) on
137 \VAR{bit-array-a} and \VAR{bit-array-b}. If \VAR{result-bit-array} is \T, put result in
138 \VAR{bit-array-a}; if it is \NIL, make a new array for
139 result.
142 \IT{\CNS*{ARRAY-RANK-LIMIT}}
144 Upper bound of array rank; $\geq 8$.
147 \IT{\CNS*{ARRAY-DIMENSION-LIMIT}}
149 Upper bound of an array dimension; $\geq 1024$.
152 \IT{\CNS*{ARRAY-TOTAL-SIZE-LIMIT}}
154 Upper bound of array size; $\geq 1024$.
157 \end{LIST}
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 \subsection{Vector Functions}
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
164 Vectors can as well be manipulated by sequence functions; see
165 section~\ref{section:Sequences}.
167 \begin{LIST}{1cm}
169 \IT{(\FU*{VECTOR} \OPn{\VAR{foo}})}
171 Return fresh \retval{simple vector of \VAR{foo}s}.
173 % No default foo in standard.
175 \IT{(\FU*{SVREF} \VAR{vector} \VAR{i})}
177 Return \retval{element \VAR{i}} of simple \VAR{vector}. \kwd{setf}able.
180 \IT{(\FU*{VECTOR-PUSH} \VAR{foo} \DES{\VAR{vector}})}
182 Return \retval{\NIL} if \VAR{vector}'s fill pointer equals size of
183 \VAR{vector}. Otherwise replace element of \VAR{vector} pointed to
184 by \retval{fill pointer} with \VAR{foo}; then increment fill
185 pointer.
188 \IT{(\FU*{VECTOR-PUSH-EXTEND} \VAR{foo} \DES{\VAR{vector}}
189 \Op{\VAR{num}})}
191 Replace element of \VAR{vector} pointed to by \retval{fill pointer} with
192 \VAR{foo}, then increment fill pointer. Extend \VAR{vector}'s size by
193 $\ge \VAR{num}$ if necessary.
196 \IT{(\FU*{VECTOR-POP} \DES{\VAR{vector}})}
198 Return \retval{element of \VAR{vector}} its fillpointer points to
199 after decrementation.
202 \IT{(\FU*{FILL-POINTER} \VAR{vector})}
204 \retval{Fill pointer} of \VAR{vector}. \kwd{setf}able.
207 \end{LIST}
211 %%% Local Variables:
212 %%% mode: latex
213 %%% TeX-master: "clqr"
214 %%% End: