This file is indexed.

/usr/share/mozart/doc/base/loop.html is in mozart-doc 1.4.0-8ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

1
2
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>10.2 Loops</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="node13.html#section.control.general">&lt;&lt; Prev</A></TD><TD><A href="node12.html">- Up -</A></TD><TD><A href="time.html#section.control.time">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="section.control.loops"><H2><A name="section.control.loops">10.2 Loops</A></H2><P> The module <A name="label698"></A><SPAN class="index"><CODE>Loop</CODE></SPAN> contains procedures that represent recursive versions of common iteration schemes with integers. However, for most common iteration patterns, the <CODE><SPAN class="keyword">for</SPAN></CODE> loop offers a nicer alternative (see <A href="../loop/index.html">``Loop Support''</A>). </P><DL><DT><A name="label699"></A><SPAN class="index"><CODE>For</CODE></SPAN> <A name="label700"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Loop<SPAN class="keyword">.</SPAN><SPAN class="string">'for'</SPAN>&nbsp;</CODE><CODE>+<I>I1</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>I2</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>I3</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>P</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>applies the unary procedure&nbsp;<CODE><I>P</I></CODE> to integers from <CODE><I>I1</I></CODE> to&nbsp;<CODE><I>I2</I></CODE> proceeding in steps of size&nbsp;<CODE><I>I3</I></CODE>. For example, </P><BLOCKQUOTE class="code"><CODE>{For&nbsp;1&nbsp;11&nbsp;3&nbsp;Browse}</CODE></BLOCKQUOTE><P> displays the numbers <CODE>1</CODE>, <CODE>4</CODE>, <CODE>7</CODE>, and&nbsp;<CODE>10</CODE> in the browser window, whereas </P><BLOCKQUOTE class="code"><CODE>{For&nbsp;11&nbsp;1&nbsp;<SPAN class="keyword">~</SPAN>3&nbsp;Browse}</CODE></BLOCKQUOTE><P> displays the numbers <CODE>11</CODE>, <CODE>8</CODE>, <CODE>5</CODE>, and&nbsp;<CODE>2</CODE>. </P></DD><DT><A name="label701"></A><SPAN class="index"><CODE>ForThread</CODE></SPAN> <A name="label702"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Loop<SPAN class="keyword">.</SPAN>forThread&nbsp;</CODE><CODE>+<I>I1</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>I2</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>I3</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>P</I></CODE><CODE>&nbsp;</CODE><CODE><I>X</I></CODE><CODE>&nbsp;</CODE><CODE>?<I>Y</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>applies the ternary procedure&nbsp;<CODE><I>P</I></CODE> to integers from <CODE><I>I1</I></CODE> to&nbsp;<CODE><I>I2</I></CODE> proceeding in steps of size&nbsp;<CODE><I>I3</I></CODE> while threading an additional accumulator argument through the iteration. The procedure&nbsp;<CODE><I>P</I></CODE> takes the accumulator argument (initially set to&nbsp;<CODE><I>X</I></CODE>) and the loop index and returns an updated accumulator. </P><P> For example, </P><BLOCKQUOTE class="code"><CODE>{ForThread&nbsp;1&nbsp;5&nbsp;1&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Is&nbsp;I}&nbsp;I<SPAN class="keyword">*</SPAN>I<SPAN class="keyword">|</SPAN>Is&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;nil}</CODE></BLOCKQUOTE><P> yields the list <CODE>[25&nbsp;16&nbsp;9&nbsp;4&nbsp;1]</CODE> as output, whereas </P><BLOCKQUOTE class="code"><CODE>{ForThread&nbsp;5&nbsp;1&nbsp;<SPAN class="keyword">~</SPAN>1&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Is&nbsp;I}&nbsp;I<SPAN class="keyword">*</SPAN>I<SPAN class="keyword">|</SPAN>Is&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;nil}</CODE></BLOCKQUOTE><P> yields <CODE>[1&nbsp;4&nbsp;9&nbsp;16&nbsp;25]</CODE> as output. </P><P> Note that <CODE>ForThread</CODE> is similar to <CODE>FoldL</CODE> (see <A href="list.html#section.records.lists">Section&nbsp;6.3</A>). </P></DD><DT><CODE>multiFor</CODE> <A name="label704"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Loop<SPAN class="keyword">.</SPAN>multiFor&nbsp;</CODE><CODE>+<I>Xs</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>P</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>generalizes <CODE>For</CODE> (see above) to the case of multiple nested loops. </P><P> <CODE><I>Xs</I></CODE> is a list containing tuples of the form <CODE><I>I1</I></CODE><CODE><SPAN class="keyword">#</SPAN></CODE><CODE><I>I2</I></CODE><CODE><SPAN class="keyword">#</SPAN></CODE><CODE><I>I3</I></CODE> specifying a loop by its start value&nbsp;<CODE><I>I1</I></CODE>, upper limit&nbsp;<CODE><I>I2</I></CODE> and step size&nbsp;<CODE><I>I3</I></CODE>. </P><P> For example, </P><BLOCKQUOTE class="code"><CODE>{Loop<SPAN class="keyword">.</SPAN>multiFor&nbsp;[1<SPAN class="keyword">#</SPAN>5<SPAN class="keyword">#</SPAN>1&nbsp;10<SPAN class="keyword">#</SPAN>20<SPAN class="keyword">#</SPAN>2]&nbsp;Browse}</CODE></BLOCKQUOTE><P> displays the lists <CODE>[1&nbsp;10]</CODE>, <CODE>[1&nbsp;12]</CODE>, ..., <CODE>[5&nbsp;20]</CODE> in the browser. </P></DD><DT><CODE>multiForThread</CODE> <A name="label706"></A> </DT><DD><BLOCKQUOTE class="synopsis"><P><CODE>{Loop<SPAN class="keyword">.</SPAN>multiForThread&nbsp;</CODE><CODE>+<I>Xs</I></CODE><CODE>&nbsp;</CODE><CODE>+<I>P</I></CODE><CODE>&nbsp;</CODE><CODE><I>X</I></CODE><CODE>&nbsp;</CODE><CODE>?<I>Y</I></CODE><CODE>}</CODE> </P></BLOCKQUOTE></DD><DD><P>generalizes <CODE>ForThread</CODE> (see above) to the case of multiple nested loops. </P><P> <CODE><I>Xs</I></CODE> is a list containing tuples of the form <CODE><I>I1</I></CODE><CODE><SPAN class="keyword">#</SPAN></CODE><CODE><I>I2</I></CODE><CODE><SPAN class="keyword">#</SPAN></CODE><CODE><I>I3</I></CODE> specifying a loop by its start value&nbsp;<CODE><I>I1</I></CODE>, upper limit&nbsp;<CODE><I>I2</I></CODE> and step size&nbsp;<CODE><I>I3</I></CODE>. </P><P> For example, </P><BLOCKQUOTE class="code"><CODE>{Loop<SPAN class="keyword">.</SPAN>multiForThread&nbsp;[1<SPAN class="keyword">#</SPAN>2<SPAN class="keyword">#</SPAN>1&nbsp;5<SPAN class="keyword">#</SPAN>4<SPAN class="keyword">#~</SPAN>1]<BR>&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Is&nbsp;[I&nbsp;J]}<BR>&nbsp;&nbsp;&nbsp;&nbsp;I<SPAN class="keyword">#</SPAN>J<SPAN class="keyword">|</SPAN>Is<BR>&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;nil}</CODE></BLOCKQUOTE><P> yields the list <CODE>[2<SPAN class="keyword">#</SPAN>4&nbsp;2<SPAN class="keyword">#</SPAN>5&nbsp;1<SPAN class="keyword">#</SPAN>4&nbsp;1<SPAN class="keyword">#</SPAN>5]</CODE> as output. </P></DD></DL><P> </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node13.html#section.control.general">&lt;&lt; Prev</A></TD><TD><A href="node12.html">- Up -</A></TD><TD><A href="time.html#section.control.time">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~duchier/">Denys&nbsp;Duchier</A>, <A href="http://www.ps.uni-sb.de/~kornstae/">Leif&nbsp;Kornstaedt</A> and&nbsp;<A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>