File r37/lisp/csl/html/r37_0157.html artifact e2103923e0 part of check-in b7c3de82ef



<A NAME=LENGTH>

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



<B>LENGTH</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>operator</B><P>
<P>
 
 <P>
<P>
The <em>length</em> operator returns the number of items in a 
<A HREF=r37_0053.html>list</A>, the 
number of 
terms in an expression, or the dimensions of an array or matrix. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>length</em>(&lt;expr&gt;) or <em>length</em> &lt;expr&gt; 
<P>
<P>
<P>
&lt;expr&gt; can be a list structure, an array, a matrix, or a scalar expression
. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
alist := {a,b,{ww,xx,yy,zz}}; 

  ALIST := {A,B,{WW,XX,YY,ZZ}} 


length alist; 

  3  


length third alist; 

  4  


dlist := {d}; 

  DLIST := {D} 


length rest dlist; 

  0  


matrix mmm(4,5); 

length mmm; 

  {4,5} 


array aaa(5,3,2); 

length aaa; 

  {6,4,3} 


eex := (x+3)**2/(x-y); 

          2
         X  + 6*X + 9
  EEX := ------------ 
            X - Y


length eex; 

  5

</TT></PRE><P>An item in a list that is itself a list only counts as one item. A
n error 
message will be printed if <em>length</em> is called on a matrix which has 
not had its dimensions set. The <em>length</em> of an array includes the 
zeroth element of each dimension, showing the full number of elements 
allocated. (Declaring an array A with n elements 
allocates A(0),A(1),...,A(n).) The 
<em>length</em> of an expression is the total number of additive terms 
appearing in the numerator and denominator of the expression. Note that 
subtraction of a term is represented internally as addition of a negative 
term. 
<P>
<P>
<P>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]