Typo fixes and minor changes in several places.
[clqr.git] / clqr-packages-and-symbols.tex
blobcbec9e8102d90af32b9a26c4d19d2a114d3f7dbc
1 % Copyright (C) 2008, 2009, 2010 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}
76 \Op{\VAR{new-nicknames}\DF{\NIL}})}
78 Rename \VAR{package}. Return \retval{renamed package}.
81 \IT{(\MC*{IN-PACKAGE }\NEV{\VAR{foo}})}
83 Make \retval{package \VAR{foo}} current.
86 \IT{(\xorGOO{\FU*{USE-PACKAGE}\\
87 \FU*{UNUSE-PACKAGE}}{\}}
88 \VAR{other-packages}
89 \Op{\VAR{package}\DF{\V{\A package\A}}})}
91 Make exported symbols of \VAR{other-packages} available in
92 \VAR{package}, or remove them from \VAR{package},
93 respectively. Return \retval{\T}.
96 \IT{\arrGOO{%
97 (\FU*{PACKAGE-USE-LIST } \VAR{package})\\
98 (\FU*{PACKAGE-USED-BY-LIST } \VAR{package})}{.}}
100 \retval{List of other packages} used by/using \VAR{package}.
103 \IT{(\FU*{DELETE-PACKAGE} \DES{\VAR{package}})}
105 Delete \VAR{package}. Return \retval{\T} if successful.
108 \IT{\V{\A package\A}\DF{\kwd{common-lisp-user}}\qquad\quad}
109 {\index{*PACKAGE*@\A PACKAGE\A}
110 The current package.
113 \IT{(\FU*{LIST-ALL-PACKAGES})\qquad\qquad\qquad}
115 \retval{List of registered packages}.
118 \IT{(\FU*{PACKAGE-NAME} \VAR{package})\qquad\quad}
120 \retval{Name of \VAR{package}}.
123 \IT{(\FU*{PACKAGE-NICKNAMES} \VAR{package})}
125 \retval{List of nicknames} of \VAR{package}.
128 \IT{(\FU*{FIND-PACKAGE} \VAR{name})}
130 \retval{Package} with \VAR{name} (case-sensitive).
133 \IT{(\FU*{FIND-ALL-SYMBOLS} \VAR{foo})}
135 \retval{List of symbols} \VAR{foo} from all
136 registered packages.
139 \IT{(\xorGOO{\FU*{INTERN}\\
140 \FU*{FIND-SYMBOL}}{\}} \VAR{foo} \Op{\VAR{package}\DF{\V{\A package\A}}})}
142 Intern or find, respectively, symbol \retval{\VAR{foo}} in
143 \VAR{package}. Second return value is one of
144 \retvalii{\kwd{:internal}}, \retvalii{\kwd{:external}}, or
145 \retvalii{\kwd{:inherited}} (or \retvalii{\NIL} if \FU{intern}
146 created a fresh symbol).
149 \IT{(\FU*{UNINTERN} \VAR{symbol} \Op{\VAR{package}\DF{\V{\A package\A}}})}
151 Remove \VAR{symbol} from \VAR{package}, return \retval{\T} on success.
154 \IT{(\xorGOO{\FU*{IMPORT}\\
155 \FU*{SHADOWING-IMPORT}}{\}} \VAR{symbols}
156 \Op{\VAR{package}\DF{\V{\A package\A}}})}
158 Make \VAR{symbols} internal to \VAR{package}. Return \retval{\T}. In
159 case of a name conflict signal correctable \kwd{package-error} or shadow
160 the old symbol, respectively.
163 \IT{(\FU*{SHADOW} \VAR{symbols}
164 \Op{\VAR{package}\DF{\V{\A package\A}}})}
166 Add \VAR{symbols} to shadowing list of \VAR{package} making equally
167 named inherited symbols shadowed. Return
168 \retval{\T}.
171 \IT{(\FU*{PACKAGE-SHADOWING-SYMBOLS} \VAR{package})}
173 \retval{List of shadowing symbols} of \VAR{package}.
176 \IT{(\FU*{EXPORT} \VAR{symbols}
177 \Op{\VAR{package}\DF{\V{\A package\A}}})}
179 Make \VAR{symbols} external to \VAR{package}. Return \retval{\T}.
182 \IT{(\FU*{UNEXPORT} \VAR{symbols} \Op{\VAR{package}\DF{\V{\A package\A}}})}
184 Revert \VAR{symbols} to internal status. Return \retval{\T}.
187 \IT{(\xorGOO{%
188 \arrGOO{%
189 \MC*{DO-SYMBOLS}\\
190 \MC*{DO-EXTERNAL-SYMBOLS}}{\}}\text{ }
191 (\NEV{\VAR{var}}\text{ } \OP{\VAR{package}\DF{\V{\A package\A}}\text{ } \Op{\VAR{result}\DF{\NIL}}})\\
192 \MC*{DO-ALL-SYMBOLS } (\VAR{var } \Op{\VAR{result}\DF{\NIL}})}{\}}
193 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
194 \OPn{\orGOO{\NEV{\VAR{tag}}\\
195 \VAR{form}}{\}}})}
197 Evaluate \SO{tagbody}-like body with \VAR{var} successively bound to every
198 symbol from \VAR{package}, to every external symbol from
199 \VAR{package}, or to every symbol from all registered packages,
200 respectively. Return \retval{values of \VAR{result}}. Implicitly,
201 the whole form is a \SO{block} named \NIL.
204 \IT{(\MC*{WITH-PACKAGE-ITERATOR} (\VAR{foo} \VAR{packages}
205 \Op{\kwd{:internal}\XOR\kwd{:external}\XOR\kwd{:inherited}})
206 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
208 Return \retval{values of \VAR{form}s}. In \VAR{form}s, successive
209 invocations of (\VAR{foo}) return: \T\ if a symbol is returned;
210 a symbol from \VAR{packages}; accessibility
211 (\kwd{:internal}, \kwd{:external}, or \kwd{:inherited}); and the
212 package the symbol belongs to.
215 \IT{(\FU*{REQUIRE} \VAR{module} \Op{\VAR{paths}\DF{\NIL}})}
217 If not in \V{\A modules\A}, try \VAR{paths} to load
218 \VAR{module} from. Signal \kwd{error} if unsuccessful. Deprecated.
221 \IT{(\FU*{PROVIDE} \VAR{module})}
223 If not already there, add \VAR{module} to
224 \V{\A modules\A}. Deprecated.
227 \IT{\V{\A modules\A}}
228 {\index{*MODULES*@\A MODULES\A}
229 List of names of loaded modules.
232 \end{LIST}
235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
236 \subsection{Symbols}
237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238 A \kwd*{symbol} has the attributes \VAR{name}, home \kwd{package}, property
239 list, and optionally value (of global constant or variable \VAR{name}) and
240 function (\kwd{function}, macro, or special operator \VAR{name}).
242 \begin{LIST}{1cm}
244 \IT{(\FU*{MAKE-SYMBOL} \VAR{name})}
246 Make fresh, uninterned \retval{symbol \VAR{name}}.
249 \IT{(\FU*{GENSYM} \Op{\VAR{s}\DF{\LIT{G}}})}
251 Return fresh, uninterned symbol \retval{\kwd{\#:}\VAR{s}\VAR{n}}
252 with \VAR{n} from \V{\A gensym-counter\A}. Increment \V{\A
253 gensym-counter\A}.%
254 \index{*GENSYM-COUNTER*@\A GENSYM-COUNTER\A}
257 \IT{(\FU*{GENTEMP} \OP{\VAR{prefix}\DF{\LIT{T}}
258 \Op{\VAR{package}\DF{\V{\A package\A}}}})}
260 Intern fresh \retval{symbol} in \retval{package}. Deprecated.
263 \IT{(\FU*{COPY-SYMBOL} \VAR{symbol} \Op{\VAR{props}\DF{\NIL}})}
265 Return uninterned \retval{copy of \VAR{symbol}}. If \VAR{props} is
266 \T, give copy the same value, function and property list.
269 \IT{\arrGOO{%
270 (\FU*{SYMBOL-NAME} \VAR{ symbol})\\
271 (\FU*{SYMBOL-PACKAGE} \VAR{ symbol})\\
272 (\FU*{SYMBOL-PLIST} \VAR{ symbol})\\
273 (\FU*{SYMBOL-VALUE} \VAR{ symbol})\\
274 (\FU*{SYMBOL-FUNCTION} \VAR{ symbol})}{.}}
276 \retval{Name}, \retval{package}, \retval{property list},
277 \retval{value}, or \retval{function}, respectively,
278 of \VAR{symbol}. \kwd{setf}able.
281 \IT{(\xorGOO{%
282 \GFU*{DOCUMENTATION}\\
283 (\kwd{SETF } \GFU{DOCUMENTATION})\VAR{ new-doc}}{\}}
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{\CNS*{T}}
300 Truth; the supertype of every type including \kwd{t}; the
301 superclass of every class except \kwd{t}; \V{\A terminal-io\A}.
304 \IT{\CNS*{NIL}\XOR{\CNS*{()}}}
306 Falsity; the empty list; the empty type, subtype of every type;
307 \V{\A standard-input\A}; \V{\A standard-output\A}; the global
308 environment.
311 \end{LIST}
314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315 \subsection[Std Packages]{Standard Packages}
316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317 \begin{LIST}{1cm}
319 \IT{\kwd*{COMMON-LISP}\XOR\kwd*{CL}}
321 Exports the defined names of Common Lisp except for those in the
322 \kwd{keyword} package.
325 \IT{\kwd*{COMMON-LISP-USER}\XOR\kwd*{CL-USER}}
327 Current package after startup; uses package \kwd{common-lisp}.
330 \IT{\kwd*{KEYWORD}}
332 Contains symbols which are defined to be of type \kwd{KEYWORD}.
335 \end{LIST}
337 %%% Local Variables:
338 %%% mode: latex
339 %%% TeX-master: "clqr"
340 %%% End: