1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/t_array.htm
2024-04-01 10:24:07 +02:00

62 lines
9.2 KiB
HTML

<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: System Class ARRAY</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="c_arrays.htm">
<LINK REL=UP HREF="c_arrays.htm">
<LINK REL=NEXT HREF="t_smp_ar.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="c_arrays.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_arrays.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="t_smp_ar.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<A NAME="array"><I>System Class</I> <B>ARRAY</B></A> <P>
<P><B>Class Precedence List:</B><P>
<A REL=DEFINITION HREF="#array"><B>array</B></A>, <A REL=DEFINITION HREF="t_t.htm#t"><B>t</B></A> <P>
<P><B>Description:</B><P>
<P>
An <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> contains <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>objects</I></A> arranged according to a Cartesian coordinate system. An <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> provides mappings from a set of <I>fixnums</I> {i0,i1,...,ir-1} to corresponding <A REL=DEFINITION HREF="26_glo_e.htm#element"><I>elements</I></A> of the <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A>, where 0 &lt;=ij &lt; dj, r is the rank of the array, and dj is the size of <A REL=DEFINITION HREF="26_glo_d.htm#dimension"><I>dimension</I></A> j of the array. <P>
When an <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> is created, the program requesting its creation may declare that all <A REL=DEFINITION HREF="26_glo_e.htm#element"><I>elements</I></A> are of a particular <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A>, called the <A REL=DEFINITION HREF="26_glo_e.htm#expressed_array_element_type"><I>expressed array element type</I></A>. The implementation is permitted to <A REL=DEFINITION HREF="26_glo_u.htm#upgrade"><I>upgrade</I></A> this type in order to produce the <A REL=DEFINITION HREF="26_glo_a.htm#actual_array_element_type"><I>actual array element type</I></A>, which is the <A REL=DEFINITION HREF="26_glo_e.htm#element_type"><I>element type</I></A> for the <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> is actually <A REL=DEFINITION HREF="26_glo_s.htm#specialized"><I>specialized</I></A>. See the <A REL=DEFINITION HREF="26_glo_f.htm#function"><I>function</I></A> <A REL=DEFINITION HREF="f_upgr_1.htm#upgraded-array-element-type"><B>upgraded-array-element-type</B></A>. <P>
<P><B>Compound Type Specifier Kind:</B><P>
<P>
Specializing. <P>
<P><B>Compound Type Specifier Syntax:</B><P>
<P>
<B>array</B> <I>[{element-type | <A REL=DEFINITION HREF="a_st.htm#ST"><B>*</B></A>} [dimension-spec]]</I><P>
<P>
<PRE>
dimension-spec::= rank | <A REL=DEFINITION HREF="a_st.htm#ST">*</A> | ({dimension | <A REL=DEFINITION HREF="a_st.htm#ST">*</A>}*)
</PRE>
<P>
<P><B>Compound Type Specifier Arguments:</B><P>
<P>
<I>dimension</I>---a <A REL=DEFINITION HREF="26_glo_v.htm#valid_array_dimension"><I>valid array dimension</I></A>. <P>
<I>element-type</I>---a <A REL=DEFINITION HREF="26_glo_t.htm#type_specifier"><I>type specifier</I></A>. <P>
<I>rank</I>---a non-negative <A REL=DEFINITION HREF="26_glo_f.htm#fixnum"><I>fixnum</I></A>. <P>
<P><B>Compound Type Specifier Description:</B><P>
<P>
This denotes the set of <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>arrays</I></A> whose <A REL=DEFINITION HREF="26_glo_e.htm#element_type"><I>element type</I></A>, <A REL=DEFINITION HREF="26_glo_r.htm#rank"><I>rank</I></A>, and <A REL=DEFINITION HREF="26_glo_d.htm#dimension"><I>dimensions</I></A> match any given <I>element-type</I>, <I>rank</I>, and <I>dimensions</I>. Specifically: <P>
If <I>element-type</I> is the <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> <A REL=DEFINITION HREF="a_st.htm#ST"><B>*</B></A>, <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>arrays</I></A> are not excluded on the basis of their <A REL=DEFINITION HREF="26_glo_e.htm#element_type"><I>element type</I></A>. Otherwise, only those <I>arrays</I> are included whose <A REL=DEFINITION HREF="26_glo_a.htm#actual_array_element_type"><I>actual array element type</I></A> is the result of <I>upgrading</I> <I>element-type</I>; see <A REL=CHILD HREF="15_aba.htm">Section 15.1.2.1 (Array Upgrading)</A>. <P>
If the <I>dimension-spec</I> is a <I>rank</I>, the set includes only those <I>arrays</I> having that <A REL=DEFINITION HREF="26_glo_r.htm#rank"><I>rank</I></A>. If the <I>dimension-spec</I> is a <A REL=DEFINITION HREF="26_glo_l.htm#list"><I>list</I></A> of <I>dimensions</I>, the set includes only those <I>arrays</I> having a <A REL=DEFINITION HREF="26_glo_r.htm#rank"><I>rank</I></A> given by the <A REL=DEFINITION HREF="26_glo_l.htm#length"><I>length</I></A> of the <I>dimensions</I>, and having the indicated <I>dimensions</I>; in this case, <A REL=DEFINITION HREF="a_st.htm#ST"><B>*</B></A> matches any value for the corresponding <A REL=DEFINITION HREF="26_glo_d.htm#dimension"><I>dimension</I></A>. If the <I>dimension-spec</I> is the <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> <A REL=DEFINITION HREF="a_st.htm#ST"><B>*</B></A>, the set is not restricted on the basis of <A REL=DEFINITION HREF="26_glo_r.htm#rank"><I>rank</I></A> or <A REL=DEFINITION HREF="26_glo_d.htm#dimension"><I>dimension</I></A>. <P>
<P>
<P><B>See Also:</B><P>
<P>
<A REL=DEFINITION HREF="v_pr_ar.htm#STprint-arrayST"><B>*print-array*</B></A>, <A REL=DEFINITION HREF="f_aref.htm#aref"><B>aref</B></A>, <A REL=DEFINITION HREF="f_mk_ar.htm#make-array"><B>make-array</B></A>, <A REL=DEFINITION HREF="t_vector.htm#vector"><B>vector</B></A>, <A REL=CHILD HREF="02_dhl.htm">Section 2.4.8.12 (Sharpsign A)</A>, <A REL=CHILD HREF="22_ach.htm">Section 22.1.3.8 (Printing Other Arrays)</A> <P>
<P><B>Notes:</B><P>
<P>
Note that the type <TT>(array t)</TT> is a proper <A REL=DEFINITION HREF="26_glo_s.htm#subtype"><I>subtype</I></A> of the type <TT>(array *)</TT>. The reason is that the type <TT>(array t)</TT> is the set of <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>arrays</I></A> that can hold any <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>object</I></A> (the <A REL=DEFINITION HREF="26_glo_e.htm#element"><I>elements</I></A> are of <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="t_t.htm#t"><B>t</B></A>, which includes all <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>objects</I></A>). On the other hand, the type <TT>(array *)</TT> is the set of all <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>arrays</I></A> whatsoever, including for example <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>arrays</I></A> that can hold only <A REL=DEFINITION HREF="26_glo_c.htm#character"><I>characters</I></A>. The type <TT>(array character)</TT> is not a <A REL=DEFINITION HREF="26_glo_s.htm#subtype"><I>subtype</I></A> of the type <TT>(array t)</TT>; the two sets are <A REL=DEFINITION HREF="26_glo_d.htm#disjoint"><I>disjoint</I></A> because the type <TT>(array character)</TT> is not the set of all <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>arrays</I></A> that can hold <A REL=DEFINITION HREF="26_glo_c.htm#character"><I>characters</I></A>, but rather the set of <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>arrays</I></A> that are specialized to hold precisely <A REL=DEFINITION HREF="26_glo_c.htm#character"><I>characters</I></A> and no other <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>objects</I></A>. <P>
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issues</A>, <I>not part of the specification</I>, apply to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss015.htm">ARRAY-TYPE-ELEMENT-TYPE-SEMANTICS:UNIFY-UPGRADING</A><LI> <A REL=CHILD HREF="../Issues/iss014.htm">ARRAY-DIMENSION-LIMIT-IMPLICATIONS:ALL-FIXNUM</A><P></UL><HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>