Update README
[clqr.git] / clqr-packages-and-symbols.tex
blobbc9bc33733ee5de90b8c143eb9648345bbc9e1eb
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 Make \VAR{symbols} of \VAR{package} shadow any otherwise
167 accessible, equally named symbols from other
168 packages. Return \retval{\T}.
171 \IT{(\FU*{PACKAGE-SHADOWING-SYMBOLS} \VAR{package})}
173 \retval{List of symbols} of \VAR{package} that shadow any
174 otherwise accessible, equally named symbols from other packages.
177 \IT{(\FU*{EXPORT} \VAR{symbols}
178 \Op{\VAR{package}\DF{\V{\A package\A}}})}
180 Make \VAR{symbols} external to \VAR{package}. Return \retval{\T}.
183 \IT{(\FU*{UNEXPORT} \VAR{symbols} \Op{\VAR{package}\DF{\V{\A package\A}}})}
185 Revert \VAR{symbols} to internal status. Return \retval{\T}.
188 \IT{(\xorGOO{%
189 \arrGOO{%
190 \MC*{DO-SYMBOLS}\\
191 \MC*{DO-EXTERNAL-SYMBOLS}}{\}}\text{ }
192 (\NEV{\VAR{var}}\text{ } \OP{\VAR{package}\DF{\V{\A
193 package\A}}\text{ } \Op{\VAR{result}\DF{\NIL}}})\\
194 \MC*{DO-ALL-SYMBOLS } (\VAR{var }
195 \Op{\VAR{result}\DF{\NIL}})}{\}}
196 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
197 \OPn{\orGOO{\NEV{\VAR{tag}}\\
198 \VAR{form}}{\}}})}
200 Evaluate \SO{tagbody}-like body with \VAR{var} successively bound to every
201 symbol from \VAR{package}, to every external symbol from
202 \VAR{package}, or to every symbol from all registered packages,
203 respectively. Return \retval{values of \VAR{result}}. Implicitly,
204 the whole form is a \SO{block} named \NIL.
207 \IT{(\MC*{WITH-PACKAGE-ITERATOR} (\VAR{foo} \VAR{packages}
208 \Op{\kwd{:internal}\XOR\kwd{:external}\XOR\kwd{:inherited}})
209 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
211 Return \retval{values of \VAR{form}s}. In \VAR{form}s, successive
212 invocations of (\VAR{foo}) return: \T\ if a symbol is returned;
213 a symbol from \VAR{packages}; accessibility
214 (\kwd{:internal}, \kwd{:external}, or \kwd{:inherited}); and the
215 package the symbol belongs to.
218 \IT{(\FU*{REQUIRE} \VAR{module} \Op{\VAR{paths}\DF{\NIL}})}
220 If not in \V{\A modules\A}, try \VAR{paths} to load
221 \VAR{module} from. Signal \kwd{error} if
222 unsuccessful. Deprecated.
225 \IT{(\FU*{PROVIDE} \VAR{module})}
227 If not already there, add \VAR{module} to
228 \V{\A modules\A}. Deprecated.
231 \IT{\V{\A modules\A}}
232 {\index{*MODULES*@\A MODULES\A}
233 List of names of loaded modules.
236 \end{LIST}
239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
240 \subsection{Symbols}
241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242 A \kwd*{symbol} has the attributes \VAR{name}, home \kwd{package}, property
243 list, and optionally value (of global constant or variable \VAR{name}) and
244 function (\kwd{function}, macro, or special operator \VAR{name}).
246 \begin{LIST}{1cm}
248 \IT{(\FU*{MAKE-SYMBOL} \VAR{name})}
250 Make fresh, uninterned \retval{symbol \VAR{name}}.
253 \IT{(\FU*{GENSYM} \Op{\VAR{s}\DF{\LIT{G}}})}
255 Return fresh, uninterned symbol \retval{\kwd{\#:}\VAR{s}\VAR{n}}
256 with \VAR{n} from \V{\A gensym-counter\A}. Increment \V{\A
257 gensym-counter\A}.%
258 \index{*GENSYM-COUNTER*@\A GENSYM-COUNTER\A}
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{%
274 (\FU*{SYMBOL-NAME} \VAR{ symbol})\\
275 (\FU*{SYMBOL-PACKAGE} \VAR{ symbol})\\
276 (\FU*{SYMBOL-PLIST} \VAR{ symbol})\\
277 (\FU*{SYMBOL-VALUE} \VAR{ symbol})\\
278 (\FU*{SYMBOL-FUNCTION} \VAR{ symbol})}{.}}
280 \retval{Name}, \retval{package}, \retval{property list},
281 \retval{value}, or \retval{function}, respectively,
282 of \VAR{symbol}. \kwd{setf}able.
285 \IT{(\xorGOO{%
286 \GFU*{DOCUMENTATION}\\
287 (\kwd{SETF } \GFU{DOCUMENTATION})\VAR{ new-doc}}{\}}
288 \VAR{foo}
289 \xorGOO{%
290 \kwd{'variable}\XOR
291 \kwd{'function}\\
292 \kwd{'compiler-macro}\\
293 \kwd{'method-combination}\\
294 \kwd{'structure}\XOR
295 \kwd{'type}\XOR
296 \kwd{'setf}\XOR
297 \T}{\}})}
298 {\index{VARIABLE}\index{FUNCTION}\index{COMPILER-MACRO}\index{METHOD-COMBINATION}\index{STRUCTURE}\index{TYPE}\index{SETF}
299 Get/set \retval{documentation string} of \VAR{foo} of given
300 type.
303 \IT{\CNS*{T}}
305 Truth; the supertype of every type including \kwd{t}; the
306 superclass of every 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;
312 \V{\A standard-input\A}; \V{\A standard-output\A}; the global
313 environment.
316 \end{LIST}
319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
320 \subsection[Std Packages]{Standard Packages}
321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322 \begin{LIST}{1cm}
324 \IT{\kwd*{COMMON-LISP}\XOR\kwd*{CL}}
326 Exports the defined names of Common Lisp except for those in the
327 \kwd{keyword} package.
330 \IT{\kwd*{COMMON-LISP-USER}\XOR\kwd*{CL-USER}}
332 Current package after startup; uses package \kwd{common-lisp}.
335 \IT{\kwd*{KEYWORD}}
337 Contains symbols which are defined to be of type \kwd{KEYWORD}.
340 \end{LIST}
342 %%% Local Variables:
343 %%% mode: latex
344 %%% TeX-master: "clqr"
345 %%% End: