Permalink
Fetching contributors…
Cannot retrieve contributors at this time
279 lines (251 sloc) 7.38 KB
% Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2018
% Bert Burgemeister
%
% Permission is granted to copy, distribute and/or modify this
% document under the terms of the GNU Free Documentation License,
% Version 1.2 or any later version published by the Free Software
% Foundation; with no Invariant Sections, no Front-Cover Texts and
% no Back-Cover Texts. For details see file COPYING.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Types and Classes}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}
\begin{center}
\begin{sideways}
\includegraphics{clqr-types-and-classes.1}
\end{sideways}
\end{center}
\caption[]{Precedence Order of System Classes
(\includegraphics{clqr-types-and-classes.3}),
Classes (\includegraphics{clqr-types-and-classes.4}),
Types (\includegraphics{clqr-types-and-classes.2}), and
Condition Types
(\includegraphics{clqr-types-and-classes.5}).\\
Every type is also a supertype of \NIL, the empty type.
\label{data-types}%
%
\index{*@\A}%
\index{T}%
\index{ATOM}%
\index{READTABLE}%
\index{PACKAGE}%
\index{SYMBOL}%
\index{KEYWORD}%
\index{BOOLEAN}%
\index{RESTART}%
\index{RANDOM-STATE}%
\index{HASH-TABLE}%
\index{STRUCTURE-OBJECT}%
\index{STANDARD-OBJECT}%
\index{NULL}%
\index{CLASS}%
\index{BUILT-IN-CLASS}%
\index{STANDARD-CLASS}%
\index{STRUCTURE-CLASS}%
\index{METHOD}%
\index{STANDARD-METHOD}%
\index{METHOD-COMBINATION}%
\index{CHARACTER}%
\index{FUNCTION}%
\index{COMPILED-FUNCTION}%
\index{GENERIC-FUNCTION}%
\index{STANDARD-GENERIC-FUNCTION}%
\index{PATHNAME}%
\index{LOGICAL-PATHNAME}%
\index{NUMBER}%
\index{COMPLEX}%
\index{REAL}%
\index{FLOAT}%
\index{SHORT-FLOAT}%
\index{SINGLE-FLOAT}%
\index{DOUBLE-FLOAT}%
\index{LONG-FLOAT}%
\index{RATIONAL}%
\index{INTEGER}%
\index{RATIO}%
\index{SIGNED-BYTE}%
\index{FIXNUM}%
\index{BIGNUM}%
\index{UNSIGNED-BYTE}%
\index{BIT}%
\index{LIST}%
\index{SEQUENCE}%
\index{CONS}%
\index{ARRAY}%
\index{SIMPLE-ARRAY}%
\index{VECTOR}%
\index{STRING}%
\index{SIMPLE-STRING}%
\index{BASE-STRING}%
\index{SIMPLE-BASE-STRING}%
\index{SIMPLE-VECTOR}%
\index{BIT-VECTOR}%
\index{SIMPLE-BIT-VECTOR}%
\index{STREAM}%
\index{FILE-STREAM}%
\index{TWO-WAY-STREAM}%
\index{SYNONYM-STREAM}%
\index{STRING-STREAM}%
\index{BROADCAST-STREAM}%
\index{CONCATENATED-STREAM}%
\index{ECHO-STREAM}%
\index{EXTENDED-CHAR}%
\index{BASE-CHAR}%
\index{STANDARD-CHAR}%
\index{CONDITION}%
\index{SERIOUS-CONDITION}%
\index{STORAGE-CONDITION}%
\index{SIMPLE-TYPE-ERROR}%
\index{TYPE-ERROR}%
\index{ERROR}%
\index{PROGRAM-ERROR}%
\index{CONTROL-ERROR}%
\index{PACKAGE-ERROR}%
\index{PRINT-NOT-READABLE}%
\index{STREAM-ERROR}%
\index{PARSE-ERROR}%
\index{CELL-ERROR}%
\index{FILE-ERROR}%
\index{ARITHMETIC-ERROR}%
\index{SIMPLE-CONDITION}%
\index{WARNING}%
\index{STYLE-WARNING}%
\index{SIMPLE-ERROR}%
\index{SIMPLE-WARNING}%
\index{UNDEFINED-FUNCTION}%
\index{UNBOUND-VARIABLE}%
\index{UNBOUND-SLOT}%
\index{END-OF-FILE}%
\index{READER-ERROR}%
\index{DIVISION-BY-ZERO}%
\index{FLOATING-POINT-INEXACT}%
\index{FLOATING-POINT-OVERFLOW}%
\index{FLOATING-POINT-UNDERFLOW}%
\index{FLOATING-POINT-INVALID-OPERATION}%
}
\end{figure}
For any class, there is always a corresponding type of the same name.
\begin{LIST}{1cm}
\IT{(\FU*{TYPEP} \VAR{foo} \VAR{type} \Op{\VAR{environment}\DF{\NIL}})}
{
\retval{\T} if \VAR{foo} is of \VAR{type}.
}
\IT{(\FU*{SUBTYPEP} \VAR{type-a} \VAR{type-b}
\Op{\VAR{environment}})}
{
Return \retval{\T} if \VAR{type-a} is a recognizable subtype of
\VAR{type-b}, and \retvalii{\NIL} if the relationship could not be
determined.
}
\IT{(\SO*{THE} \NEV{\VAR{type}} \VAR{form})}
{
Declare \retval{values of \VAR{form}} to be of
\VAR{type}.
}
\IT{(\FU*{COERCE} \VAR{object} \VAR{type})}
{
Coerce \retval{\VAR{object}} into \VAR{type}.
}
\IT{(\MC*{TYPECASE} \VAR{foo} \OPn{(\NEV{\VAR{type}} \PROGN{\VAR{a-form}})}
\OP{(\xorGOO{\kwd*{OTHERWISE}\\
\T}{\}} \PROGN{\VAR{b-form}\DF{\NIL}})})}
{
Return \retval{values of the first \OPn{\VAR{a-form}}} whose \VAR{type} is
\VAR{foo} of. Return \retval{values of \VAR{b-form}s} if no
\VAR{type} matches.
% Keep \OPn{\VAR{a-form}} instead of the otherwise preferable
% \VAR{a-form}s because we're talking about one set of a-forms out
% of several.
}
\IT{(\xorGOO{%
\MC*{ETYPECASE}\\
\MC*{CTYPECASE}}{\}}
\VAR{foo}
\OPn{(\NEV{\VAR{type}} \PROGN{\VAR{form}})})}
{
Return \retval{values of the first \OPn{\VAR{form}}} whose \VAR{type} is
\VAR{foo} of. Signal non-correctable/correctable \kwd{type-error}
if no \VAR{type} matches.
% Keep \OPn{\VAR{form}} instead of the otherwise preferable
% \VAR{form}s because we're talking about one set of forms out
% of several.
}
\IT{(\FU*{TYPE-OF} \VAR{foo})}
{
\retval{Type of \VAR{foo}}.
}
\IT{(\MC*{CHECK-TYPE} \VAR{place} \VAR{type}
\Op{\VAR{string}\DF{\Goo{\LIT{a}\XOR\LIT{an}}\hspace{.3ex}\VAR{type}}})}
{
Signal correctable \kwd{type-error} if \VAR{place} is
not of \VAR{type}. Return \retval{\NIL}.
}
\IT{(\FU*{STREAM-ELEMENT-TYPE} \VAR{stream})}
{
\retval{Type} of \VAR{stream} objects.
}
\IT{(\FU*{ARRAY-ELEMENT-TYPE} \VAR{array})}
{
Element \retval{type} \VAR{array} can hold.
}
\IT{(\FU*{UPGRADED-ARRAY-ELEMENT-TYPE} \VAR{type}
\Op{\VAR{environment}\DF{\NIL}})}
{
\retval{Element type} of most specialized array capable of holding
elements of \VAR{type}.
}
\IT{(\MC*{DEFTYPE} \VAR{foo} (\OPn{\VAR{macro-$\lambda$}})
\orGOO{%
\OPn{(\kwd{declare } \OPn{\NEV{\VAR{decl}}})}\\
\NEV{\VAR{doc}}}{\}}
\PROGN{\VAR{form}})}
{
Define type \retval{\VAR{foo}} which when referenced as (\VAR{foo}
\OPn{\NEV{\VAR{arg}}}) (or as \VAR{foo} if \VAR{macro-$\lambda$}
doesn't contain any required parameters) applies expanded \VAR{form}s to \VAR{arg}s
returning the new type. For (\OPn{\VAR{macro-$\lambda$}}) see
page \pageref{section:Macros} but with default value of \kwd{\A}
instead of \NIL. \VAR{form}s are enclosed in an implicit \SO{block}
named \VAR{foo}.
}
\IT{\arrGOO{(\kwd*{EQL } \VAR{foo})\\
(\kwd*{MEMBER } \OPn{\VAR{foo}})}{.}}
{
Specifier for a type comprising \VAR{foo} or \VAR{foo}s.
}
\IT{(\kwd*{SATISFIES} \VAR{predicate})}
{
Type specifier for all objects satisfying \VAR{predicate}.
}
\IT{(\kwd*{MOD} \VAR{n})}
{
Type specifier for all non-negative integers $<n$.
}
\IT{(\kwd*{NOT} \VAR{type})}
{
Complement of type.
}
\IT{(\kwd*{AND} \OPn{\VAR{type}}\DF{\T})}
{
Type specifier for intersection of \VAR{type}s.
}
\IT{(\kwd*{OR} \OPn{\VAR{type}}\DF{\NIL})}
{
Type specifier for union of \VAR{type}s.
}
\IT{(\kwd*{VALUES} \OPn{\VAR{type}} \OP{\OPn{\kwd{\&optional} \VAR{type}}
\Op{\kwd{\&rest} \VAR{other-args}}})}
{
Type specifier for multiple values.
}
\IT{\kwd{\A}}
{
\index{*@\A}%
As a type argument (cf.\ Figure \ref{data-types}): no restriction.
}
\end{LIST}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "clqr"
%%% End: