cosmetic surgery on loop figure; a few minor changes elsewhere
[clqr.git] / clqr-packages-and-symbols.tex
blob07dae0fb62065b6a4ca63d22f8c364e15e078b58
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{Packages and Symbols}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 \subsection{Predicates}
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17 \begin{LIST}{1cm}
19 \IT{\arrGOO{(\FU*{SYMBOLP} \VAR{ foo})\\
20 (\FU*{PACKAGEP} \VAR{ foo})\\
21 (\FU*{KEYWORDP} \VAR{ foo})}{.}}
23 \retval{\T} if \VAR{foo} is of indicated type.
26 \end{LIST}
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 \subsection{Packages}
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 \begin{LIST}{1cm}
34 \IT{\kwd*{:}\VAR{bar}\XOR\kwd*{keyword}\kwd{:}\VAR{bar}}
36 Keyword, evaluates to \retval{:\VAR{bar}}.
39 \IT{\VAR{package}\kwd*{:}\VAR{symbol}}
41 Exported \VAR{symbol} of \VAR{package}.
44 \IT{\VAR{package}\kwd*{::}\VAR{symbol}}
46 Possibly unexported \VAR{symbol} of \VAR{package}.
49 \IT{(\MC*{DEFPACKAGE}\VAR{ foo}
50 \orGOO{%
51 \OPn{(\kwd{:nicknames }\OPn{\VAR{nick}})}\\
52 (\kwd{:documentation }\VAR{string})\\
53 \OPn{(\kwd{:intern }\OPn{\VAR{interned-symbol}})}\\
54 \OPn{(\kwd{:use }\OPn{\VAR{used-package}})}\\
55 \OPn{(\kwd{:import-from }\VAR{pkg } \OPn{\VAR{imported-symbol}})}\\
56 \OPn{(\kwd{:shadowing-import-from}\VAR{ pkg}\OPn{\VAR{ shd-symbol}})}\\
57 \OPn{(\kwd{:shadow }\OPn{\VAR{shd-symbol}})}\\
58 \OPn{(\kwd{:export }\OPn{\VAR{exported-symbol}})}\\
59 (\kwd{:size }\VAR{int})%
60 }{\}})}
62 Create or modify \retval{package \VAR{foo}} with
63 \VAR{interned-symbol}s, symbols from \VAR{used-package}s,
64 \VAR{imported-symbol}s, and \VAR{shd-symbol}s. Add \VAR{shd-symbol}s
65 to \VAR{foo}'s shadowing list.
68 \IT{(\FU*{MAKE-PACKAGE} \VAR{foo}
69 \orGOO{\kwd{:nicknames }(\OPn{\VAR{nick}})\DF{\NIL}\\
70 \kwd{:use }(\OPn{\VAR{used-package}})}{\}})}
72 Create \retval{package \VAR{foo}}.
75 \IT{(\FU*{RENAME-PACKAGE} \VAR{package} \VAR{new-name} \Op{\VAR{new-nicknames}\DF{\NIL}})}
77 Rename \VAR{package}. Return \retval{renamed package}.
80 \IT{(\MC*{IN-PACKAGE }\NEV{\VAR{foo}})}
82 Make \retval{package \VAR{foo}} current.
85 \IT{(\xorGOO{\FU*{USE-PACKAGE}\\
86 \FU*{UNUSE-PACKAGE}}{\}}
87 \VAR{other-packages}
88 \Op{\VAR{package}\DF{\V{\A package\A}}})}
90 Make exported symbols of \VAR{other-packages} available in \VAR{package}, or remove them
91 from \VAR{package}, respectively. Return \retval{\T}.
94 \IT{(\FU*{DELETE-PACKAGE} \DES{\VAR{package}})}
96 Delete \VAR{package}. Return \retval{\T} if successful.
99 \IT{\V*{\A package\A}}
100 {The current package.
103 \IT{(\FU*{LIST-ALL-PACKAGES})}
105 \retval{List of registered packages}.
108 \IT{(\FU*{PACKAGE-NAME} \VAR{package})}
110 \retval{Name of \VAR{package}}.
113 \IT{(\FU*{PACKAGE-NICKNAMES} \VAR{package})}
115 \retval{List of nicknames} of \VAR{package}.
118 \IT{(\FU*{FIND-PACKAGE} \VAR{name})}
120 \retval{Package object} with \VAR{name} (case-sensitive).
123 \IT{(\FU*{PACKAGE-USE-LIST} \VAR{package})}
125 \retval{List of other packages} used by \VAR{package}.
128 \IT{(\FU*{PACKAGE-USED-BY-LIST} \VAR{package})}
130 \retval{List of other packages} using \VAR{package}.
133 \IT{(\FU*{FIND-ALL-SYMBOLS} \VAR{name})}
135 Return \retval{list of symbols} with \VAR{name} from all
136 registered packages.
139 \IT{(\FU*{SYMBOL-PACKAGE} \VAR{symbol})}
141 Return the \retval{package \VAR{symbol} came from}.
144 \IT{(\xorGOO{\FU*{INTERN}\\
145 \FU*{FIND-SYMBOL}}{\}} \VAR{foo} \Op{\VAR{package}})}
147 Intern or find, respectively, symbol \retval{\VAR{foo}} in
148 \VAR{package}. Second return value is one of
149 \retvalii{\kwd{:internal}}, \retvalii{\kwd{:external}}, or
150 \retvalii{\kwd{:inherited}} (or \retvalii{\NIL} if \FU{intern}
151 created a fresh symbol).
154 \IT{(\FU*{UNINTERN} \VAR{symbol} \Op{\VAR{package}})}
156 Remove \VAR{symbol} from \VAR{package}, return \retval{\T} on success.
159 \IT{(\xorGOO{\FU*{IMPORT}\\
160 \FU*{SHADOWING-IMPORT}}{\}} \VAR{symbols}
161 \Op{\VAR{package}\DF{\kwd{\A package\A}}})}
163 Make \VAR{symbols} internal to \VAR{package}. Return \retval{\T}. In
164 case of a name conflict, signal \kwd{package-error}, or shadow
165 the old symbol, respectively.
168 \IT{(\FU*{SHADOW} \VAR{symbols}
169 \Op{\VAR{package}\DF{\kwd{\A package\A}}})}
171 Add \VAR{symbols} to shadowing list of \VAR{package} making equally
172 named inherited symbols shadowed. Return
173 \retval{\T}.
176 \IT{(\FU*{PACKAGE-SHADOWING-SYMBOLS} \VAR{package})}
178 \retval{List of shadowing symbols} of \VAR{package}.
181 \IT{(\FU*{EXPORT} \VAR{symbols}
182 \Op{\VAR{package}\DF{\V{\A package\A}}})}
184 Make \VAR{symbols} external to \VAR{package}. Return \retval{\T}.
187 \IT{(\FU*{UNEXPORT} \VAR{symbols} \VAR{package})}
189 Revert \VAR{symbols} to internal status. Return \retval{\T}.
192 \IT{(\xorGOO{%
193 \arrGOO{%
194 \MC*{DO-SYMBOLS}\\
195 \MC*{DO-EXTERNAL-SYMBOLS}}{\}}\text{ }
196 (\NEV{\VAR{var}}\text{ } \OP{\VAR{package}\DF{\V{\A package\A}}\text{ } \Op{\VAR{result}\DF{\NIL}}})\\
197 \MC*{DO-ALL-SYMBOLS } (\VAR{var } \Op{\VAR{result}\DF{\NIL}})}{\}}
198 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
199 \OPn{\orGOO{\NEV{\VAR{tag}}\\
200 \VAR{form}}{\}}})}
202 Evaluate \SO{tagbody}-like body with \VAR{var} successively bound to every
203 symbol from \VAR{package}, to every external symbol from
204 \VAR{package}, or to every symbol from all registered packages,
205 respectively. Return \retval{values of \VAR{result}}. Implicitly,
206 the whole form is a \SO{block} named \NIL.
209 \IT{(\MC*{WITH-PACKAGE-ITERATOR} (\VAR{name} \VAR{packages}
210 \Op{\kwd{:internal}\XOR\kwd{:external}\XOR\kwd{:inherited}})
211 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
213 Return \retval{values of \VAR{form}s}. In \VAR{form}s, successive
214 invocations of (\VAR{name}) return: \T\ if a symbol is returned;
215 a symbol from \VAR{packages}; accessibility
216 (\kwd{:internal}, \kwd{:external}, or \kwd{:inherited}); and the
217 package the symbol belongs to.
220 \IT{(\FU*{REQUIRE} \VAR{module} \Op{\VAR{path-list}})}
222 If not in \V{\A modules\A}, try paths in \VAR{path-list} to load
223 module from. Signal \kwd{error} if unsuccessful. Deprecated.
226 \IT{(\FU*{PROVIDE} \VAR{module})}
228 If not already there, add \VAR{module} to
229 \V{\A modules\A}. Deprecated.
232 \IT{\V*{\A modules\A}}
234 List of names of modules loaded into Lisp image.
237 \end{LIST}
240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
241 \subsection{Symbols}
242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
243 A \kwd*{symbol} has the attributes \VAR{name}, home \kwd{package}, property
244 list, and optionally value (of global constant or variable \VAR{name}) and
245 function (of \kwd{function}, macro, or special operator \VAR{name}).
247 \begin{LIST}{1cm}
249 \IT{(\FU*{MAKE-SYMBOL} \VAR{name})}
251 Make fresh, uninterned \retval{symbol \VAR{name}}.
254 \IT{(\FU*{GENSYM} \Op{\VAR{x}\DF{\LIT{G}}})}
256 Return fresh symbol \retval{\kwd{\#:}\VAR{x}\VAR{n}}, with \VAR{n} from
257 \V*{\A gensym-counter\A} which is incremented only in case no \VAR{x}
258 is given.
261 \IT{(\FU*{GENTEMP} \OP{\VAR{prefix}\DF{\LIT{T}}
262 \Op{\VAR{package}\DF{\V{\A package\A}}}})}
264 Intern fresh \retval{symbol} in \retval{package}. Deprecated.
267 \IT{(\FU*{COPY-SYMBOL} \VAR{symbol} \Op{\VAR{props}\DF{\NIL}})}
269 Return uninterned \retval{copy of \VAR{symbol}}. If \VAR{props} is
270 \T, give copy the same value, function and property list.
273 \IT{\arrGOO{(\FU*{SYMBOL-FUNCTION} \VAR{ symbol})\\
274 (\FU*{SYMBOL-VALUE} \VAR{ symbol})\\
275 (\FU*{SYMBOL-PLIST} \VAR{ symbol})}{.}}
277 \retval{Function}, \retval{value}, or \retval{property list}, respectively,
278 of \VAR{symbol}. \kwd{setf}able.
281 \IT{(\xorGOO{%
282 \GFU*{DOCUMENTATION}\\
283 (\kwd{SETF } \GFU{DOCUMENTATION})}{\}}
284 \VAR{foo}
285 \Goo{\kwd{'variable}%
286 \XOR\kwd{'function}%
287 \XOR\kwd{'compiler-macro}%
288 \XOR\kwd{'method-combination}%
289 \XOR\kwd{'structure}%
290 \XOR\kwd{'type}%
291 \XOR\kwd{'setf}%
292 \XOR\T})}
293 {\index{VARIABLE}\index{FUNCTION}\index{COMPILER-MACRO}\index{METHOD-COMBINATION}\index{STRUCTURE}\index{TYPE}\index{SETF}
294 Get/set \retval{documentation string} of \VAR{foo} of given
295 type.
298 \IT{(\FU*{SYMBOL-NAME} \VAR{ symbol})}
300 \retval{Name} of \VAR{symbol}.
303 \IT{\CNS*{T}}
305 Truth; the supertype of every type including \kwd{t}; the superclass of every
306 class except \kwd{t}; \V{\A terminal-io\A}.
309 \IT{\CNS*{NIL}\XOR{\CNS*{()}}}
311 Falsity; the empty list; the empty type, subtype of every type; \V{\A standard-input\A};
312 \V{\A standard-output\A}; the global environment.
315 \end{LIST}
318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
319 \subsection[Std Packages]{Standard Packages}
320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
321 \begin{LIST}{1cm}
323 \IT{\kwd*{COMMON-LISP}\XOR\kwd*{CL}}
325 Exports the defined names of Common Lisp except for those in the
326 \kwd{keyword} package.
329 \IT{\kwd*{COMMON-LISP-USER}\XOR\kwd*{CL-USER}}
331 Current package after startup; uses package \kwd{common-lisp}.
334 \IT{\kwd*{KEYWORD}}
336 Contains symbols which are defined to be of type \kwd{KEYWORD}.
339 \end{LIST}