emacs.d/clones/lisp/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node157.html

64 lines
3.4 KiB
HTML
Raw Normal View History

2022-08-26 19:11:35 +02:00
<!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>17. Arrays</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Arrays">
<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=tex2html3483 HREF="node158.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html3481 HREF="clm.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html3475 HREF="node156.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html3485 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html3486 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html3484 HREF="node158.html"> Array Creation</A>
<B>Up:</B> <A NAME=tex2html3482 HREF="clm.html">Common Lisp the Language</A>
<B> Previous:</B> <A NAME=tex2html3476 HREF="node156.html"> Primitive Hash Function</A>
<HR> <P>
<H1><A NAME=SECTION002100000000000000000>17. Arrays</A></H1>
<P>
An array is an object with components arranged according
to a rectilinear coordinate system.
In principle, an
array in Common Lisp may have any number of dimensions, including zero.
(A zero-dimensional array has exactly one element.)
In practice, an implementation may limit the number of dimensions
supported, but
every Common Lisp implementation must support arrays of up to
seven dimensions.
Each dimension is a non-negative integer; if any dimension of an array is zero,
the array has no elements.
<P>
An array may be a <i>general array</i>, meaning each element may be any Lisp
object, or it may be a <i>specialized array</i>, meaning that each element
must be of a given restricted type.
<P>
<img align=bottom alt="old_change_begin" src="gif/old_change_begin.gif"><br>
One-dimensional arrays are called vectors. General vectors may contain
any Lisp object. Vectors whose elements are restricted to type
<tt>string-char</tt> are called <i>strings</i>. Vectors whose elements are
restricted to type <tt>bit</tt> are called <i>bit-vectors</i>.
<br><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=17508>&#160;</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>.
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<HR>
<UL>
<LI> <A NAME=tex2html3487 HREF="node158.html#SECTION002110000000000000000"> Array Creation</A>
<LI> <A NAME=tex2html3488 HREF="node159.html#SECTION002120000000000000000"> Array Access</A>
<LI> <A NAME=tex2html3489 HREF="node160.html#SECTION002130000000000000000"> Array Information</A>
<LI> <A NAME=tex2html3490 HREF="node161.html#SECTION002140000000000000000"> Functions on Arrays of Bits</A>
<LI> <A NAME=tex2html3491 HREF="node162.html#SECTION002150000000000000000"> Fill Pointers</A>
<LI> <A NAME=tex2html3492 HREF="node163.html#SECTION002160000000000000000"> Changing the Dimensions of an Array</A>
</UL>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>