Artifact 63eac5fbce10a9c0eea8ff2bf0739d19e4c5590e9bce26af149dc6ea1c0e0b87:
- Executable file
r37/lisp/csl/html/r37_0188.html
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 2624) [annotate] [blame] [check-ins using] [more...]
<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><identifier>(<dimensions>) {<em>,</em><identifier>(<dimensions>)}* <P> <P> <P> <identifier> may be any valid REDUCE identifier. If the identifier was already an array, a warning message is given that the array has been redefined. <dimensions> are of form <integer>{,<integer>}*. <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 <not> 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>