
<A NAME=ARRAY>

<TITLE>ARRAY</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>ARRAY</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>declaration</B><P>
<P>
 
The <em>array</em> declaration declares a list of identifiers to be of type 
<em>array</em>, and sets all their entries to 0. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>array</em>&lt;identifier&gt;(&lt;dimensions&gt;) 
 {<em>,</em>&lt;identifier&gt;(&lt;dimensions&gt;)}* 
<P>
<P>
<P>
&lt;identifier&gt; may be any valid REDUCE identifier. If the identifier 
was already an array, a warning message is given that the array has been 
redefined. &lt;dimensions&gt; are of form 
 &lt;integer&gt;{,&lt;integer&gt;}*. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
array a(2,5),b(3,3,3),c(200); 

array a(3,5); 

  *** ARRAY A REDEFINED 


a(3,4); 

  0 


length a; 

  {4,6}

</TT></PRE><P>Arrays are always global, even if defined inside a procedure or bl
ock 
statement. Their status as an array remains until the variable is 
reset by 
<A HREF=r37_0189.html>clear</A>. Arrays may not have the same names as operators
, 
procedures or scalar variables. 
<P>
<P>
Array elements are referred to by the usual notation: <em>a(i,j)</em> 
returns the jth element of the ith row. The 
<A HREF=r37_0065.html>assign</A>ment operator 
<em>:=</em> is used to put values into the array. Arrays as a whole 
cannot be subject to assignment by 
<A HREF=r37_0199.html>let</A> or <em>:=</em> ; the 
assignment operator <em>:=</em> is only valid for individual elements. 
<P>
<P>
When you use 
<A HREF=r37_0199.html>let</A> on an array element, the contents of that 
element become the argument to <em>let</em>. Thus, if the element 
contains a number or some other expression that is not a valid argument 
for this command, you get an error message. If the element contains an 
identifier, the identifier has the substitution rule attached to it 
globally. The same behavior occurs with 
<A HREF=r37_0189.html>clear</A>. If the array 
element contains an identifier or simple_expression, it is cleared. Do 
&lt;not&gt; use <em>clear</em> to try to set an array element to 0. Because 
of the side effects of either <em>let</em> or <em>clear</em>, it is unwise 
to apply either of these to array elements. 
<P>
<P>
Array indices always start with 0, so that the declaration <em>array a(5)</em> 
sets aside 6 units of space, indexed from 0 through 5, and initializes 
them to 0. The 
<A HREF=r37_0157.html>length</A> command returns a list of the true number of 
elements in each dimension. 
<P>
<P>
<P>
