Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 1465

mozart-1.4.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>2.3 Accumulators</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node7.html#section.loop.control">&lt;&lt; Prev</A></TD><TD><A href="node5.html">- Up -</A></TD></TR></TABLE><DIV id="section.loop.accu"><H2><A name="section.loop.accu">2.3 Accumulators</A></H2><P>loops can also be used in expression position to accumulate values. The value of the implicit accumulator is returned when the loop terminates. </P><DL><DT><CODE><SPAN class="keyword">&lt;&lt;</SPAN>collect&nbsp;E<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>adds element E at the end of the list being collected. Can be used together will <CODE>append</CODE></P></DD><DT><CODE><SPAN class="keyword">&lt;&lt;</SPAN>append&nbsp;L<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>appends L at the end of the list being collected. Can be used together with <CODE>collect</CODE></P></DD><DT><CODE><SPAN class="keyword">&lt;&lt;</SPAN>count&nbsp;B<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>if <CODE>B</CODE> is true, adds 1 to the accumulated counter. Can be used together with <CODE>sum</CODE></P></DD><DT><CODE><SPAN class="keyword">&lt;&lt;</SPAN>sum&nbsp;E<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>adds <CODE>E</CODE> to the accumulated counter. Can be used together with <CODE>count</CODE></P></DD><DT><CODE><SPAN class="keyword">&lt;&lt;</SPAN>maximize&nbsp;E<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>replaces the current accumulated value if <CODE>E</CODE> is greater</P></DD><DT><CODE><SPAN class="keyword">&lt;&lt;</SPAN>minimize&nbsp;E<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>replaces the current accumulated value if <CODE>E</CODE> is smaller</P></DD></DL><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node7.html#section.loop.control">&lt;&lt; Prev</A></TD><TD><A href="node5.html">- Up -</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~duchier/">Denys&nbsp;Duchier</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>