/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 >></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"><<for</SPAN> X = E1 while E2 <SPAN class="string">'then'</SPAN> E3<SPAN class="keyword">>></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 E2</CODE> is missing, it defaults to <CODE>while<BR><SPAN class="keyword">true</SPAN></CODE>. If <CODE><SPAN class="string">'then'</SPAN> E3</CODE> is missing, <CODE>X</CODE> always keeps the same value, i. e. it defaults to <CODE><SPAN class="string">'then'</SPAN> X</CODE>.</P></DD><DT><CODE><SPAN class="keyword"><<for</SPAN> X <SPAN class="string">'from'</SPAN> E1 to E2 by E3<SPAN class="keyword">>></SPAN></CODE></DT><DD><P>This is very much like the C <CODE><SPAN class="keyword">for</SPAN>(X=E1;X<SPAN class="keyword"><=</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 E2</CODE> is missing, there is no upper limit. If <CODE>by E3</CODE> is missing, it defaults to <CODE>by 1</CODE>. If <CODE><SPAN class="string">'from'</SPAN> E1</CODE> is missing, it defaults to <CODE><SPAN class="string">'from'</SPAN> 1</CODE>. <CODE>E3</CODE> should always be positive. </P><P>It is also permitted to use <CODE>downfrom E1</CODE> and/or <CODE>downto E2</CODE> to indicate counting downwards. However, <CODE>E3</CODE> should still be positive.</P></DD><DT><CODE><SPAN class="keyword"><<for</SPAN> X <SPAN class="string">'in'</SPAN> L<SPAN class="keyword">>></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> <SPAN class="keyword"><<for</SPAN> X <SPAN class="string">'in'</SPAN> [a b c d e]<SPAN class="keyword">>></SPAN> <BR> <SPAN class="keyword"><<for</SPAN> I <SPAN class="string">'from'</SPAN> 1 to 3<SPAN class="keyword">>></SPAN> <BR> {Show 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> <SPAN class="keyword"><<for</SPAN> X <SPAN class="string">'in'</SPAN> [a b c d e]<SPAN class="keyword">>></SPAN> <BR> <SPAN class="keyword"><<for</SPAN> I <SPAN class="string">'from'</SPAN> 1 to 3<SPAN class="keyword">>></SPAN> <BR><SPAN class="keyword">in</SPAN> <BR> {Show 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 >></A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~duchier/">Denys Duchier</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|