minor changes
[clqr.git] / clqr-symbols-and-packages.tex
blob529512131588b9c644cc53c36aa56c64f0642b70
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 \section{Symbols and Packages}
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 \begin{LIST}{1cm}
6 \IT{\arrGOO{(\FU*{SYMBOLP} \VAR{foo})\\
7 (\FU*{PACKAGEP} \VAR{foo})}{\}}}
8 Return \retval{\T} if \VAR{foo} is of type \kwd{symbol} or
9 \kwd{package}, resp.
11 \IT{(\FU*{BOUNDP} \VAR{symbol})}
12 \retval{\T} if \VAR{symbol} is bound.
14 \IT{(\FU*{KEYWORDP} \VAR{foo})}
15 \retval{\T} if \VAR{foo} is a keyword.
17 \IT{(\kwd*{T})}
18 Truth, or \V{*terminal-io*}.
20 \IT{\KWD*{:}\VAR{foo}}
21 Keyword, evaluates to \retval{:\VAR{foo}}
23 \IT{\Goo{(\CNS*{NIL})\XOR{\kwd*{()}}}}
24 Falsehood, the empty list, \V{*standard-input*},
25 \V{*standard-output*}, or the global environment.
27 \IT{\V*{*package*}} The current package.
29 \IT{(\FU*{SYMBOL-PACKAGE '}\VAR{foo})}
30 Return the \retval{package \VAR{foo} came from}.
32 \IT{(\GFU*{DOCUMENTATION} \kwd{'}\VAR{foo}
33 \Goo{\kwd{variable}\XOR\kwd{function}\XOR
34 \kwd*{compiler-macro}\XOR
35 \kwd{method-combination}\XOR
36 \T\XOR\kwd{structure}
37 \XOR\kwd{type}\XOR\kwd{setf}\XOR\T})}
38 Return \retval{documentation string} of \VAR{foo} of given
39 type. \kwd{setf}able.
41 \IT{(\kwd*{DEFPACKAGE}\VAR{ foo}
42 \orGOO{\OPn{(\kwd{:use }\OPn{\VAR{bar}})}\\
43 \OPn{(\kwd{:nicknames }\OPn{\VAR{nick}})}\\
44 (\kwd{:documentation }\VAR{doc})\\
45 \OPn{(\kwd{:export }\OPn{\VAR{baz}})}\\
46 \OPn{(\kwd{:import-from }\VAR{p} \OPn{\VAR{n}})}\\
47 \OPn{(\kwd{:intern }\OPn{\VAR{n}})}\\
48 \OPn{(\kwd{:shadow}\XOR\Goo{\kwd{:shadowing-import-from}\VAR{ p}\OPn{\VAR{ jnk}}})}\\
49 (\kwd{:size }\VAR{int})\\
50 }{\}})}
51 Return \retval{defined package \VAR{foo}} which inherits symbols
52 exported by packages \VAR{bar} excluding \VAR{jnk}s and some
53 symbols. \VAR{n}s from package \VAR{p}; exports \VAR{baz}es.
55 \IT{(\kwd*{IN-PACKAGE }\VAR{foo})}
56 Make \retval{package \VAR{foo}} current.
58 \IT{(\FU*{USE-PACKAGE} (\OPn{\VAR{foo}})
59 \Op{\VAR{package}}\DF{\kwd{*package*}})}
60 Make exported symbols of packages \VAR{foo} available in
61 \VAR{package}. Return \retval{\T}.
63 \IT{(\FU*{UNUSE-PACKAGE} (\OPn{\VAR{foo}})
64 \Op{\VAR{package}}\DF{\kwd{*package*}})}
65 Remove packages \VAR{foo} from use-list of \VAR{package}.
67 \IT{(\FU*{DELETE-PACKAGE} \VAR{package})} Delete \VAR{package}. Return
68 \retval{\T} if successful.
70 \IT{(\FU*{FIND-PACKAGE} \Goo{\VAR{name}\XOR\VAR{package}})} Return
71 \retval{package object} with \VAR{name} (case-sensitive).
73 \IT{(\FU*{LIST-ALL-PACKAGES})} \retval{List of registered packages}.
75 \IT{(\FU*{MAKE-PACKAGE} \VAR{name}
76 \orGOO{\kwd{:nicknames }(\OPn{\VAR{nick}})\DF{\NIL}\\
77 \kwd{:use }(\OPn{package})}{\}})}
78 Create \retval{package \VAR{name}}.
80 \IT{(\xorGOO{%
81 \xorGOO{%
82 \FU*{DO-ALL-SYMBOLS}\\
83 \FU*{DO-SYMBOLS}}{\}}
84 (\VAR{var} \OP{\VAR{package} \Op{\VAR{result}}})\\
85 \FU*{DO-EXTERNAL-SYMBOLS} (\VAR{var} \Op{\VAR{result}})}{\}}
86 \OPn{(\kwd{declare} \OPn{\VAR{decl}})}
87 \orGOO{\OPn{tag}\\
88 \OPn{form}}{\}})}
89 Evaluate \VAR{form}s with \VAR{var} successively bound to all
90 symbols from all registered packages, to all symbols from
91 \VAR{package}, or to all external symbols from \VAR{package}, resp. Return
92 \retval{value of \VAR{result}}.
94 \IT{(\FU*{EXPORT} \VAR{symbols} \Op{\VAR{package}\DF{\kwd{*package*}}})}
95 Make \VAR{symbols} external to \VAR{package}. Return \retval{\T}.
97 \IT{(\FU*{UNEXPORT} \VAR{symbols} \VAR{package})}
98 Revert \VAR{symbols} to internal status. Return \retval{\T}.
100 \IT{(\FU*{PACKAGE-NAME} \VAR{package})} \retval{Name of \VAR{package}}.
102 \IT{(\FU*{PACKAGE-NICKNAMES} \VAR{package})}
103 \retval{List of nicknames} of \VAR{package}.
105 \IT{(\FU*{PACKAGE-SHADOWING-SYMBOLS} \VAR{package})}
106 \retval{List of shadowing symbols} of \VAR{package}.
108 \IT{(\FU*{PACKAGE-USE-LIST} \VAR{package})}
109 \retval{List of other packeges} used by \VAR{package}.
111 \IT{(\FU*{PACKAGE-USED-BY-LIST} \VAR{package})}
112 \retval{List of other packages} using \VAR{package}.
114 \IT{(\FU*{RENAME-PACKAGE} \VAR{package} \Op{(\OPn{nick})\DF{\NIL}})}
115 Rename \VAR{package}. Return \retval{renamed package}.
117 \IT{(\SF*{WITH-PACKAGE-ITERATOR} (\VAR{name} \RP{\VAR{package}}
118 \Op{\kwd{:internal}\XOR\kwd{:external}\XOR\kwd{:inherited}})
119 \OPn{(\kwd{declare} \OPn{\VAR{decl}})} \OPn{\VAR{form}})}
120 Return \retval{values of \VAR{form}s}. In the body, successive
121 invocations of (\VAR{name}) return: \T\ if a symbol is returned;
122 a symbol from a \VAR{package}; accessibility
123 (\kwd{:internal}, \kwd{:external}, or \kwd{:inherited}); and the
124 package the symbol belongs to.
126 \IT{(\xorGOO{\FU*{INTERN}\\
127 \FU*{FIND-SYMBOL}}{\} \VAR{name} \Op{\VAR{package}}})}
128 Intern or find, resp., \retval{symbol \VAR{name}} in
129 \VAR{package}. Second return value is one of
130 \retvalii{\kwd{:internal}}, \retvalii{\kwd{:external}}, or
131 \retvalii{\kwd{:inherited}}.
133 \IT{(\FU*{SHADOW} \RP{\VAR{symbol}}
134 \Op{\VAR{package}\DF{\kwd{*package*}}})}
135 Add \VAR{symbol}s to shadowed list of \VAR{package}. Return \retval{\T}.
137 \IT{(\xorGOO{\FU*{IMPORT}\\
138 \FU*{SHADOWING-IMPORT}}{\}}\RP{\VAR{symbol}}
139 \Op{\VAR{package}\DF{\kwd{*package*}}})}
140 Make \VAR{symbol}s internal to \VAR{package}. Return \retval{\T}. In
141 case of a name conflict, signal \kwd{package-error}, or shadow
142 the old symbol, resp.
144 \IT{(\kwd*{UNINTERN} \VAR{symbol} \Op{\VAR{package}})}
145 Remove \VAR{symbol} from \VAR{package}, return \retval{\T} on success.
147 \IT{(\FU*{FIND-ALL-SYMBOLS} \VAR{string})}
148 Return \retval{list of symbols} with name \VAR{string} from all
149 registered packages.
151 \end{LIST}