This file is indexed.

/usr/share/mozart/doc/macro/node6.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>2.1 Iterators</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="node5.html">- Up -</A></TD><TD><A href="node7.html#section.loop.control">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="section.loop.iterators"><H2><A name="section.loop.iterators">2.1 Iterators</A></H2><P>A loop is typically intended to <EM>iterate</EM> over one or more quantities. This is realized by iterators expressed with the <CODE><SPAN class="keyword">for</SPAN></CODE> macro. </P><DL><DT><CODE><SPAN class="keyword">&lt;&lt;for</SPAN>&nbsp;X&nbsp;=&nbsp;E1&nbsp;while&nbsp;E2&nbsp;<SPAN class="string">'then'</SPAN>&nbsp;E3<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>This is very much like the C <CODE><SPAN class="keyword">for</SPAN>(X=E1;E2;X=E3)</CODE> loop. If <CODE>while&nbsp;E2</CODE> is missing, it defaults to <CODE>while<BR><SPAN class="keyword">true</SPAN></CODE>. If <CODE><SPAN class="string">'then'</SPAN>&nbsp;E3</CODE> is missing, <CODE>X</CODE> always keeps the same value, i.&nbsp;e. it defaults to <CODE><SPAN class="string">'then'</SPAN>&nbsp;X</CODE>.</P></DD><DT><CODE><SPAN class="keyword">&lt;&lt;for</SPAN>&nbsp;X&nbsp;<SPAN class="string">'from'</SPAN>&nbsp;E1&nbsp;to&nbsp;E2&nbsp;by&nbsp;E3<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>This is very much like the C <CODE><SPAN class="keyword">for</SPAN>(X=E1;X<SPAN class="keyword">&lt;=</SPAN>E2;X<SPAN class="keyword">+</SPAN>=E3)</CODE> loop but introduces appropriate local variables for <CODE>E2</CODE> and <CODE>E3</CODE> so that they are only computed once. If <CODE>to&nbsp;E2</CODE> is missing, there is no upper limit. If <CODE>by&nbsp;E3</CODE> is missing, it defaults to <CODE>by&nbsp;1</CODE>. If <CODE><SPAN class="string">'from'</SPAN>&nbsp;E1</CODE> is missing, it defaults to <CODE><SPAN class="string">'from'</SPAN>&nbsp;1</CODE>. <CODE>E3</CODE> should always be positive. </P><P>It is also permitted to use <CODE>downfrom&nbsp;E1</CODE> and/or <CODE>downto&nbsp;E2</CODE> to indicate counting downwards. However, <CODE>E3</CODE> should still be positive.</P></DD><DT><CODE><SPAN class="keyword">&lt;&lt;for</SPAN>&nbsp;X&nbsp;<SPAN class="string">'in'</SPAN>&nbsp;L<SPAN class="keyword">&gt;&gt;</SPAN></CODE></DT><DD><P>Iterates over the elements of <CODE>L</CODE>.</P></DD></DL><P> An iterator may be introduced anywhere within the scope of the loop macro. The semantics is always identical: it declares an iterator globally for this loop. More than one iterator may be specified: the loop terminates as soon as one iterator terminates. For example: </P><BLOCKQUOTE class="code"><CODE>loop<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">&lt;&lt;for</SPAN>&nbsp;X&nbsp;<SPAN class="string">'in'</SPAN>&nbsp;[a&nbsp;b&nbsp;c&nbsp;d&nbsp;e]<SPAN class="keyword">&gt;&gt;</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">&lt;&lt;for</SPAN>&nbsp;I&nbsp;<SPAN class="string">'from'</SPAN>&nbsp;1&nbsp;to&nbsp;3<SPAN class="keyword">&gt;&gt;</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;{Show&nbsp;I<SPAN class="keyword">#</SPAN>X}<BR><SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> prints out: </P><BLOCKQUOTE class="code"><CODE>1<SPAN class="keyword">#</SPAN>a<BR>2<SPAN class="keyword">#</SPAN>b<BR>3<SPAN class="keyword">#</SPAN>c</CODE></BLOCKQUOTE><P> Note that for esthetic reasons you may like to separate the section declaring the iterators from that of the body: </P><BLOCKQUOTE class="code"><CODE>loop<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">&lt;&lt;for</SPAN>&nbsp;X&nbsp;<SPAN class="string">'in'</SPAN>&nbsp;[a&nbsp;b&nbsp;c&nbsp;d&nbsp;e]<SPAN class="keyword">&gt;&gt;</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">&lt;&lt;for</SPAN>&nbsp;I&nbsp;<SPAN class="string">'from'</SPAN>&nbsp;1&nbsp;to&nbsp;3<SPAN class="keyword">&gt;&gt;</SPAN>&nbsp;<BR><SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;{Show&nbsp;I<SPAN class="keyword">#</SPAN>X}<BR><SPAN class="keyword">end</SPAN></CODE></BLOCKQUOTE><P> This is possible because the syntactic occurrence of an iterator simply expands to <CODE><SPAN class="keyword">skip</SPAN></CODE>. Thus, in the above, the local declarations simply contain two <CODE><SPAN class="keyword">skip</SPAN></CODE>. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node5.html">- Up -</A></TD><TD><A href="node7.html#section.loop.control">Next &gt;&gt;</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 (20110908185330)</SPAN></ADDRESS></BODY></HTML>