Fix fresh-line description
[clqr.git] / clqr-arrays.tex
blob8ca63d8618ad8f18e424c51c13660e4df71ad21c
1 % Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014 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; with no Invariant Sections, no Front-Cover Texts and
6 % no Back-Cover Texts. For details see file COPYING.
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10 \section{Arrays}
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \label{section:Arrays}
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 \subsection{Predicates}
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17 \begin{LIST}{1cm}
19 \IT{\arrGOO{%
20 (\FU*{ARRAYP} \VAR{ foo})\\
21 (\FU*{VECTORP} \VAR{ foo})\\
22 (\FU*{SIMPLE-VECTOR-P} \VAR{ foo})\\
23 (\FU*{BIT-VECTOR-P} \VAR{ foo})\\
24 (\FU*{SIMPLE-BIT-VECTOR-P} \VAR{ foo})}{.}}
26 \retval{\T} if \VAR{foo} is of indicated type.
29 \IT{\arrGOO{(\FU*{ADJUSTABLE-ARRAY-P} \VAR{ array})\\
30 (\FU*{ARRAY-HAS-FILL-POINTER-P} \VAR{ array})}{.}}
32 \retval{\T} if \VAR{array} is adjustable/has a fill pointer,
33 respectively.
36 \IT{(\FU*{ARRAY-IN-BOUNDS-P} \VAR{array} \Op{\VAR{subscripts}})}
38 Return \retval{\T} if \VAR{subscripts} are in \VAR{array}'s bounds.
40 % No default subscripts in standard.
42 \end{LIST}
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 \subsection{Array Functions}
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 \begin{LIST}{1cm}
50 \IT{(\xorGOO{%
51 \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{ tree-or-array}\\
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}, page \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 \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: