173 lines
7.8 KiB
HTML
173 lines
7.8 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
||
|
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
||
|
<HEAD>
|
||
|
<TITLE>4.6. Type Specifiers That Abbreviate</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" Type Specifiers That Abbreviate">
|
||
|
<meta name="keywords" value="clm">
|
||
|
<meta name="resource-type" value="document">
|
||
|
<meta name="distribution" value="global">
|
||
|
<P>
|
||
|
<b>Common Lisp the Language, 2nd Edition</b>
|
||
|
<BR> <HR><A NAME=tex2html2127 HREF="node51.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2125 HREF="node44.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2119 HREF="node49.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2129 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2130 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html2128 HREF="node51.html"> Defining New Type </A>
|
||
|
<B>Up:</B> <A NAME=tex2html2126 HREF="node44.html"> Type Specifiers</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html2120 HREF="node49.html"> Type Specifiers That </A>
|
||
|
<HR> <P>
|
||
|
<H1><A NAME=SECTION00860000000000000000>4.6. Type Specifiers That Abbreviate</A></H1>
|
||
|
<P>
|
||
|
The following type specifiers are, for the most part,
|
||
|
abbreviations for other type specifiers that would be far too
|
||
|
verbose to write out explicitly (using, for example, <tt>member</tt>).
|
||
|
<P>
|
||
|
<DL COMPACT><DT><tt>(integer <i>low</i> <i>high</i>)</tt>
|
||
|
<DD>
|
||
|
Denotes the integers between
|
||
|
<i>low</i> and <i>high</i>. The limits <i>low</i> and <i>high</i>
|
||
|
must each be an integer, a list of an integer, or unspecified.
|
||
|
An integer is an inclusive limit,
|
||
|
a list of an integer is an exclusive limit, and
|
||
|
<tt>*</tt> means that a limit does not exist
|
||
|
and so effectively denotes minus or plus infinity, respectively.
|
||
|
The type <tt>fixnum</tt> is simply a name
|
||
|
for <tt>(integer <i>smallest</i> <i>largest</i>)</tt> for implementation-dependent
|
||
|
values of <i>smallest</i> and <i>largest</i>
|
||
|
(see <tt>most-negative-fixnum</tt> and <tt>most-positive-fixnum</tt>).
|
||
|
The type <tt>(integer 0 1)</tt>
|
||
|
is so useful that it has the special name <tt>bit</tt>.
|
||
|
<P>
|
||
|
<DT><tt>(mod <i>n</i>)</tt>
|
||
|
<DD>
|
||
|
Denotes the set of non-negative integers less than <i>n</i>.
|
||
|
This is equivalent to <tt>(integer 0 <i>n</i>-1)</tt>
|
||
|
or to <tt>(integer 0 (<i>n</i>))</tt>.
|
||
|
<P>
|
||
|
<DT><tt>(signed-byte <i>s</i>)</tt>
|
||
|
<DD>
|
||
|
Denotes the set of integers that can be represented
|
||
|
in two's-complement form in a byte of <i>s</i> bits. This is
|
||
|
equivalent to
|
||
|
<tt>(integer <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap40311.gif"> <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap40313.gif">)</tt>.
|
||
|
Simply <tt>signed-byte</tt> or <tt>(signed-byte *)</tt> is the same as <tt>integer</tt>.
|
||
|
<P>
|
||
|
<DT><tt>(unsigned-byte <i>s</i>)</tt>
|
||
|
<DD>
|
||
|
Denotes the set of non-negative integers that can be
|
||
|
represented in a byte of <i>s</i> bits. This is equivalent to <tt>(mod
|
||
|
<IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap40315.gif">)</tt>, that is, <tt>(integer 0 <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap40317.gif">)</tt>.
|
||
|
Simply <tt>unsigned-byte</tt> or <tt>(unsigned-byte *)</tt> is the same as
|
||
|
<tt>(integer 0 *)</tt>, the set of non-negative integers.
|
||
|
<P>
|
||
|
<DT><tt>(rational <i>low</i> <i>high</i>)</tt>
|
||
|
<DD>
|
||
|
Denotes the rationals between
|
||
|
<i>low</i> and <i>high</i>. The limits <i>low</i> and <i>high</i>
|
||
|
must each be a rational, a list of a rational, or unspecified.
|
||
|
A rational is an inclusive limit,
|
||
|
a list of a rational is an exclusive limit, and
|
||
|
<tt>*</tt> means that a limit does not exist
|
||
|
and so effectively denotes minus or plus infinity, respectively.
|
||
|
<P>
|
||
|
<DT><tt>(float <i>low</i> <i>high</i>)</tt>
|
||
|
<DD>
|
||
|
Denotes the set of floating-point numbers between
|
||
|
<i>low</i> and <i>high</i>. The limits <i>low</i> and <i>high</i>
|
||
|
must each be a floating-point number, a list of a floating-point number,
|
||
|
or unspecified; a floating-point number is an inclusive limit, a list of a
|
||
|
floating-point number is an exclusive limit, and
|
||
|
<tt>*</tt> means that a limit does not exist
|
||
|
and so effectively denotes minus or plus infinity, respectively.
|
||
|
<P>
|
||
|
In a similar manner, one may use:
|
||
|
<P><pre>
|
||
|
(short-float <i>low</i> <i>high</i>) <BR>(single-float <i>low</i> <i>high</i>) <BR>(double-float <i>low</i> <i>high</i>) <BR>(long-float <i>low</i> <i>high</i>)
|
||
|
</pre><P>
|
||
|
In this case, if a limit is a floating-point
|
||
|
number (or a list of one), it must be one of the appropriate format.
|
||
|
<P>
|
||
|
</DL>
|
||
|
<P>
|
||
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
||
|
X3J13 voted in March 1989 (REAL-NUMBER-TYPE) <A NAME=2555> </A> to add a list form of the <tt>real</tt>
|
||
|
type specifier to denote an interval of <tt>real</tt> numbers.
|
||
|
<P>
|
||
|
<DL COMPACT><DT><tt>(real <i>low</i> <i>high</i>)</tt>
|
||
|
<DD>
|
||
|
Denotes the real numbers between
|
||
|
<i>low</i> and <i>high</i>. The limits <i>low</i> and <i>high</i>
|
||
|
must each be a real, a list of a real, or unspecified.
|
||
|
A real is an inclusive limit,
|
||
|
a list of a real is an exclusive limit, and
|
||
|
<tt>*</tt> means that a limit does not exist
|
||
|
and so effectively denotes minus or plus infinity, respectively.
|
||
|
<P>
|
||
|
</DL>
|
||
|
<img align=bottom alt="change_end" src="gif/change_end.gif">
|
||
|
<P>
|
||
|
<img align=bottom alt="old_change_begin" src="gif/old_change_begin.gif"><br>
|
||
|
<DL COMPACT><DT><tt>(string <i>size</i>)</tt>
|
||
|
<DD>
|
||
|
Means the same as
|
||
|
<tt>(array string-char (<i>size</i>))</tt>: the set of strings of the indicated size.
|
||
|
<P>
|
||
|
<DT><tt>(simple-string <i>size</i>)</tt>
|
||
|
<DD>
|
||
|
Means the same
|
||
|
as <tt>(simple-array string-char (<i>size</i>))</tt>: the set of simple
|
||
|
strings of the indicated size.
|
||
|
<P>
|
||
|
</DL>
|
||
|
<img align=bottom alt="old_change_end" src="gif/old_change_end.gif">
|
||
|
<P>
|
||
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
||
|
X3J13 voted in March 1989 (CHARACTER-PROPOSAL) <A NAME=2577> </A>
|
||
|
to eliminate the type <tt>string-char</tt> and to redefine the type
|
||
|
<tt>string</tt> to be the union of one or more specialized vector
|
||
|
types, the types of whose elements are subtypes of the type <tt>character</tt>.
|
||
|
Similarly, the type
|
||
|
<tt>simple-string</tt> is redefined to be the union of one or more specialized
|
||
|
simple vector
|
||
|
types, the types of whose elements are subtypes of the type <tt>character</tt>.
|
||
|
<P>
|
||
|
<DL COMPACT><DT><tt>(base-string <i>size</i>)</tt>
|
||
|
<DD>
|
||
|
Means the same as
|
||
|
<tt>(vector base-character <i>size</i>)</tt>: the set of base
|
||
|
strings of the indicated size.
|
||
|
<P>
|
||
|
|
||
|
<P>
|
||
|
<DT><tt>(simple-base-string <i>size</i>)</tt>
|
||
|
<DD>
|
||
|
Means the same
|
||
|
as <tt>(simple-array base-character (<i>size</i>))</tt>: the set of simple base
|
||
|
strings of the indicated size.
|
||
|
<P>
|
||
|
</DL>
|
||
|
<img align=bottom alt="change_end" src="gif/change_end.gif">
|
||
|
<P>
|
||
|
<DL COMPACT><DT><tt>(bit-vector <i>size</i>)</tt>
|
||
|
<DD>
|
||
|
Means the same as <tt>(array bit (<i>size</i>))</tt>:
|
||
|
the set of bit-vectors of the indicated size.
|
||
|
<P>
|
||
|
<DT><tt>(simple-bit-vector <i>size</i>)</tt>
|
||
|
<DD>
|
||
|
This means the same as
|
||
|
<tt>(simple-array bit (<i>size</i>))</tt>: the set of bit-vectors of
|
||
|
the indicated size.
|
||
|
<P>
|
||
|
</DL>
|
||
|
<P>
|
||
|
<BR> <HR><A NAME=tex2html2127 HREF="node51.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2125 HREF="node44.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2119 HREF="node49.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2129 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2130 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html2128 HREF="node51.html"> Defining New Type </A>
|
||
|
<B>Up:</B> <A NAME=tex2html2126 HREF="node44.html"> Type Specifiers</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html2120 HREF="node49.html"> Type Specifiers That </A>
|
||
|
<HR> <P>
|
||
|
<HR>
|
||
|
<P><ADDRESS>
|
||
|
AI.Repository@cs.cmu.edu
|
||
|
</ADDRESS>
|
||
|
</BODY>
|