0ea515f55ccdea816ce43f9927a64dbbc8f4a3e0
[clqr.git] / clqr-types-and-classes.tex
blob0ea515f55ccdea816ce43f9927a64dbbc8f4a3e0
1 % Copyright (C) 2008, 2009, 2010, 2011, 2012 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{Types and Classes}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 \begin{figure}
15 \begin{center}
16 \begin{sideways}
17 \includegraphics{clqr-types-and-classes.1}
18 \end{sideways}
19 \end{center}
20 \caption[]{Precedence Order of System Classes
21 (\includegraphics{clqr-types-and-classes.3}),
22 Classes (\includegraphics{clqr-types-and-classes.4}),
23 Types (\includegraphics{clqr-types-and-classes.2}), and
24 Condition Types
25 (\includegraphics{clqr-types-and-classes.5}).
26 \label{data-types}%
28 \index{*@\A}%
29 \index{T}%
30 \index{ATOM}%
31 \index{READTABLE}%
32 \index{PACKAGE}%
33 \index{SYMBOL}%
34 \index{KEYWORD}%
35 \index{BOOLEAN}%
36 \index{RESTART}%
37 \index{RANDOM-STATE}%
38 \index{HASH-TABLE}%
39 \index{STRUCTURE-OBJECT}%
40 \index{STANDARD-OBJECT}%
41 \index{NULL}%
42 \index{CLASS}%
43 \index{BUILT-IN-CLASS}%
44 \index{STANDARD-CLASS}%
45 \index{STRUCTURE-CLASS}%
46 \index{METHOD}%
47 \index{STANDARD-METHOD}%
48 \index{METHOD-COMBINATION}%
49 \index{CHARACTER}%
50 \index{FUNCTION}%
51 \index{COMPILED-FUNCTION}%
52 \index{GENERIC-FUNCTION}%
53 \index{STANDARD-GENERIC-FUNCTION}%
54 \index{PATHNAME}%
55 \index{LOGICAL-PATHNAME}%
56 \index{NUMBER}%
57 \index{COMPLEX}%
58 \index{REAL}%
59 \index{FLOAT}%
60 \index{SHORT-FLOAT}%
61 \index{SINGLE-FLOAT}%
62 \index{DOUBLE-FLOAT}%
63 \index{LONG-FLOAT}%
64 \index{RATIONAL}%
65 \index{INTEGER}%
66 \index{RATIO}%
67 \index{SIGNED-BYTE}%
68 \index{FIXNUM}%
69 \index{BIGNUM}%
70 \index{UNSIGNED-BYTE}%
71 \index{BIT}%
72 \index{LIST}%
73 \index{SEQUENCE}%
74 \index{CONS}%
75 \index{ARRAY}%
76 \index{SIMPLE-ARRAY}%
77 \index{VECTOR}%
78 \index{STRING}%
79 \index{SIMPLE-STRING}%
80 \index{BASE-STRING}%
81 \index{SIMPLE-BASE-STRING}%
82 \index{SIMPLE-VECTOR}%
83 \index{BIT-VECTOR}%
84 \index{SIMPLE-BIT-VECTOR}%
85 \index{STREAM}%
86 \index{FILE-STREAM}%
87 \index{TWO-WAY-STREAM}%
88 \index{SYNONYM-STREAM}%
89 \index{STRING-STREAM}%
90 \index{BROADCAST-STREAM}%
91 \index{CONCATENATED-STREAM}%
92 \index{ECHO-STREAM}%
93 \index{EXTENDED-CHAR}%
94 \index{BASE-CHAR}%
95 \index{STANDARD-CHAR}%
96 \index{CONDITION}%
97 \index{SERIOUS-CONDITION}%
98 \index{STORAGE-CONDITION}%
99 \index{SIMPLE-TYPE-ERROR}%
100 \index{TYPE-ERROR}%
101 \index{ERROR}%
102 \index{PROGRAM-ERROR}%
103 \index{CONTROL-ERROR}%
104 \index{PACKAGE-ERROR}%
105 \index{PRINT-NOT-READABLE}%
106 \index{STREAM-ERROR}%
107 \index{PARSE-ERROR}%
108 \index{CELL-ERROR}%
109 \index{FILE-ERROR}%
110 \index{ARITHMETIC-ERROR}%
111 \index{SIMPLE-CONDITION}%
112 \index{WARNING}%
113 \index{STYLE-WARNING}%
114 \index{SIMPLE-ERROR}%
115 \index{SIMPLE-WARNING}%
116 \index{UNDEFINED-FUNCTION}%
117 \index{UNBOUND-VARIABLE}%
118 \index{UNBOUND-SLOT}%
119 \index{END-OF-FILE}%
120 \index{READER-ERROR}%
121 \index{DIVISION-BY-ZERO}%
122 \index{FLOATING-POINT-INEXACT}%
123 \index{FLOATING-POINT-OVERFLOW}%
124 \index{FLOATING-POINT-UNDERFLOW}%
125 \index{FLOATING-POINT-INVALID-OPERATION}%
127 \end{figure}
129 For any class, there is always a corresponding type of the same name.
131 \begin{LIST}{1cm}
133 \IT{(\FU*{TYPEP} \VAR{foo} \VAR{type} \Op{\VAR{environment}\DF{\NIL}})}
135 \retval{\T} if \VAR{foo} is of \VAR{type}.
138 \IT{(\FU*{SUBTYPEP} \VAR{type-a} \VAR{type-b}
139 \Op{\VAR{environment}})}
141 Return \retval{\T} if \VAR{type-a} is a recognizable subtype of
142 \VAR{type-b}, and \retvalii{\NIL} if the relationship could not be
143 determined.
146 \IT{(\SO*{THE} \NEV{\VAR{type}} \VAR{form})}
148 Declare \retval{values of \VAR{form}} to be of
149 \VAR{type}.
152 \IT{(\FU*{COERCE} \VAR{object} \VAR{type})}
154 Coerce \retval{\VAR{object}} into \VAR{type}.
157 \IT{(\MC*{TYPECASE} \VAR{foo} \OPn{(\NEV{\VAR{type}} \PROGN{\VAR{a-form}})}
158 \OP{(\xorGOO{\kwd*{OTHERWISE}\\
159 \T}{\}} \PROGN{\VAR{b-form}\DF{\NIL}})})}
161 Return \retval{values of the \VAR{a-form}s} whose \VAR{type} is
162 \VAR{foo} of. Return \retval{values of \VAR{b-form}s} if no
163 \VAR{type} matches.
166 \IT{(\xorGOO{%
167 \MC*{ETYPECASE}\\
168 \MC*{CTYPECASE}}{\}}
169 \VAR{foo}
170 \OPn{(\NEV{\VAR{type}} \PROGN{\VAR{form}})})}
172 Return \retval{values} of the first \OPn{\VAR{form}} whose \VAR{type} is
173 \VAR{foo} of. Signal non-correctable/correctable \kwd{type-error}
174 if no \VAR{type} matches.
177 \IT{(\FU*{TYPE-OF} \VAR{foo})}
179 \retval{Type of \VAR{foo}}.
182 \IT{(\MC*{CHECK-TYPE} \VAR{place} \VAR{type}
183 \Op{\VAR{string}\DF{\Goo{\LIT{a}\XOR\LIT{an}}\hspace{.3ex}\VAR{type}}})}
185 Signal correctable \kwd{type-error} if \VAR{place} is
186 not of \VAR{type}. Return \retval{\NIL}.
189 \IT{(\FU*{STREAM-ELEMENT-TYPE} \VAR{stream})}
191 \retval{Type} of \VAR{stream} objects.
194 \IT{(\FU*{ARRAY-ELEMENT-TYPE} \VAR{array})}
196 Element \retval{type} \VAR{array} can hold.
199 \IT{(\FU*{UPGRADED-ARRAY-ELEMENT-TYPE} \VAR{type}
200 \Op{\VAR{environment}\DF{\NIL}})}
202 \retval{Element type} of most specialized array capable of holding
203 elements of \VAR{type}.
206 \IT{(\MC*{DEFTYPE} \VAR{foo} (\OPn{\VAR{macro-$\lambda$}})
207 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \Op{\NEV{\VAR{doc}}}
208 \PROGN{\VAR{form}})}
210 Define type \retval{\VAR{foo}} which when referenced as (\VAR{foo}
211 \OPn{\NEV{\VAR{arg}}}) applies expanded \VAR{form}s to \VAR{arg}s
212 returning the new type. For (\OPn{\VAR{macro-$\lambda$}}) see
213 p.~\pageref{section:Macros} but with default value of \kwd{\A}
214 instead of \NIL. \VAR{form}s are enclosed in an implicit \SO{block}
215 named \VAR{foo}.
218 \IT{\arrGOO{(\kwd*{EQL } \VAR{foo})\\
219 (\kwd*{MEMBER } \OPn{\VAR{foo}})}{.}}
221 Specifier for a type comprising \VAR{foo} or \VAR{foo}s.
224 \IT{(\kwd*{SATISFIES} \VAR{predicate})}
226 Type specifier for all objects satisfying \VAR{predicate}.
229 \IT{(\kwd*{MOD} \VAR{n})}
231 Type specifier for all non-negative integers $<n$.
234 \IT{(\kwd*{NOT} \VAR{type})}
236 Complement of type.
239 \IT{(\kwd*{AND} \OPn{\VAR{type}}\DF{\T})}
241 Type specifier for intersection of \VAR{type}s.
244 \IT{(\kwd*{OR} \OPn{\VAR{type}}\DF{\NIL})}
246 Type specifier for union of \VAR{type}s.
249 \IT{(\kwd*{VALUES} \OPn{\VAR{type}} \OP{\OPn{\kwd{\&optional} \VAR{type}}
250 \Op{\kwd{\&rest} \VAR{other-args}}})}
252 Type specifier for multiple values.
255 \IT{\kwd{\A}}
257 \index{*@\A}%
258 As a type argument (cf.\ Figure \ref{data-types}): no restriction.
260 \end{LIST}
264 %%% Local Variables:
265 %%% mode: latex
266 %%% TeX-master: "clqr"
267 %%% End: