html and cron script
[clqr.git] / clqr-arrays.tex
blob9b5adf88c2ea826a967ed9c5f2e9f8fb16d0905f
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{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.
42 \end{LIST}
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 \subsection{Array Functions}
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 \begin{LIST}{1cm}
50 \IT{(\xorGOO{\FU*{MAKE-ARRAY}\\
51 \FU*{ADJUST-ARRAY } \DES{\VAR{array}}}{\}}
52 \VAR{dimensions}
53 \orGOO{\kwd{:element-type} \VAR{ type}\DF{\T}\\
54 \kwd{:adjustable} \VAR{ bool}\DF{\NIL}\\
55 \kwd{:fill-pointer } \Goo{\VAR{num}\XOR\VAR{bool}}\DF{\NIL}\\
56 \xorGOO{\kwd{:initial-element} \VAR{ obj}\\
57 \kwd{:initial-contents} \VAR{ sequence}\\
58 \kwd{:displaced-to } \VAR{array}\DF{\NIL}\text{ }
59 \Op{\kwd{:displaced-index-offset } \VAR{i}\DF{\LIT{0}}}}{.}}{\}})}
61 Return fresh, or readjust, respectively, \retval{vector or array} of
62 \VAR{dimensions}.
65 \IT{(\FU*{AREF} \VAR{array} \OP{\VAR{subscripts}})}
67 Return
68 \retval{array element} pointed to by \VAR{subscripts}. \kwd{setf}able.
71 \IT{(\FU*{ROW-MAJOR-AREF} \VAR{array} \VAR{i})}
73 Return \retval{\VAR{i}th element} of \VAR{array} in row-major
74 order. \kwd{setf}able.
77 \IT{(\FU*{ARRAY-ROW-MAJOR-INDEX} \VAR{array} \Op{\VAR{subscripts}})}
79 \retval{Index} in row-major order of the element denoted by \VAR{subscripts}.
82 \IT{(\FU*{ARRAY-DIMENSIONS} \VAR{array})}
84 \retval{List} containing the lengths of \VAR{array}'s dimensions.
87 \IT{(\FU*{ARRAY-DIMENSION} \VAR{array} \VAR{i})}
89 \retval{Length of \VAR{i}th dimension} of \VAR{array}.
92 \IT{(\FU*{ARRAY-TOTAL-SIZE} \VAR{array})}
94 \retval{Number of elements} in \VAR{array}.
97 \IT{(\FU*{ARRAY-DISPLACEMENT} \VAR{array})}
99 \retval{Target array} and \retvalii{offset}.
102 \IT{(\FU*{ARRAY-RANK} \VAR{array})}
104 \retval{Number of dimensions} of \VAR{array}.
107 \IT{\arrGOO{(\FU*{BIT} \VAR{ bit-array } \Op{\VAR{subscripts}})\\
108 (\FU*{SBIT} \VAR{ simple-bit-array } \Op{\VAR{subscripts}})}{.}}
110 Return \retval{element} of \VAR{bit-array} or of
111 \VAR{simple-bit-array}. \kwd{setf}able.
114 \IT{(\FU*{BIT-NOT} \DES{\VAR{bit-array}} \Op{\DES{\VAR{result-bit-array}}\DF{\NIL}})}
116 Return \retval{result} of bit-wise negation of \VAR{bit-array}. If \VAR{result-bit-array} is \T, put
117 result in \VAR{bit-array}; if it is \NIL, make a new array for
118 result.
121 \IT{(\xorGOO{%
122 \FU*{BIT-EQV}\\
123 \FU*{BIT-AND}\\
124 \FU*{BIT-ANDC1}\\
125 \FU*{BIT-ANDC2}\\
126 \FU*{BIT-NAND}\\
127 \FU*{BIT-IOR}\\
128 \FU*{BIT-ORC1}\\
129 \FU*{BIT-ORC2}\\
130 \FU*{BIT-XOR}\\
131 \FU*{BIT-NOR}}{\}} \DES{\VAR{bit-array-a}} \VAR{bit-array-b}
132 \Op{\DES{\VAR{result-bit-array}}\DF{\NIL}})}
134 Return \retval{result} of bit-wise logical operations
135 (cf.\ operations of \FU{boole}, p.\ \pageref{section:Logic Functions}) on
136 \VAR{bit-array-a} and \VAR{bit-array-b}. If \VAR{result-bit-array} is \T, put result in
137 \VAR{bit-array-a}; if it is \NIL, make a new array for
138 result.
141 \IT{\CNS*{ARRAY-RANK-LIMIT}}
143 Upper bound of array rank, $\geq 8$.
146 \IT{\CNS*{ARRAY-DIMENSION-LIMIT}}
148 Upper bound of an array dimension, $\geq 1024$.
151 \IT{\CNS*{ARRAY-TOTAL-SIZE-LIMIT}}
153 Upper bound of array size, $\geq 1024$.
156 \end{LIST}
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160 \subsection{Vector Functions}
161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 Vectors can as well be manipulated by sequence functions, see
164 s.~\ref{section:Sequences}.
166 \begin{LIST}{1cm}
168 \IT{(\FU*{VECTOR} \OPn{\VAR{foo}})}
170 Return fresh \retval{simple vector of \VAR{foo}s}.
173 \IT{(\FU*{SVREF} \VAR{vector} \VAR{i})}
175 Return \retval{\VAR{i}th
176 element} of \VAR{vector}. \kwd{setf}able.
179 \IT{(\FU*{VECTOR-PUSH} \VAR{foo} \DES{\VAR{vector}})}
181 Return \retval{\NIL} if \VAR{vector}'s fill pointer equals size of
182 \VAR{vector}. Otherwise replace element of \VAR{vector} pointed to
183 by \retval{fill pointer} with \VAR{foo}; then increment fill
184 pointer.
187 \IT{(\FU*{VECTOR-PUSH-EXTEND} \VAR{foo} \DES{\VAR{vector}}
188 \Op{\VAR{num}})}
190 Replace element of \VAR{vector} pointed to by \retval{fill pointer} with
191 \VAR{foo}, then increment fill pointer. Extend \VAR{vector}'s size by
192 $\ge \VAR{num}$ if necessary.
195 \IT{(\FU*{VECTOR-POP} \DES{\VAR{vector}})}
197 Return \retval{element of \VAR{vector}} its fillpointer points to
198 after decrementation.
201 \IT{(\FU*{FILL-POINTER} \VAR{vector})}
203 Return \retval{fill pointer} of \VAR{vector}. \kwd{setf}able.
206 \end{LIST}