Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > ee3d8430cc80796773ea2e1c8ad4ef5d > files > 110

ocaml-reins-devel-0.1a-10.fc15.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="Up" href="Reins.Iterator.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Reins" rel="Chapter" href="Reins.html"><title>Reins.Iterator.S</title>
</head>
<body>
<div class="navbar">&nbsp;<a href="Reins.Iterator.html">Up</a>
&nbsp;</div>
<center><h1>Module type <a href="type_Reins.Iterator.S.html">Reins.Iterator.S</a></h1></center>
<br>
<pre><span class="keyword">module type</span> S = <code class="code">sig</code> <a href="Reins.Iterator.S.html">..</a> <code class="code">end</code></pre>The signature for an iterator over an arbitrary collection<br>
<hr width="100%">
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> </pre>
<div class="info">
The type of iterators.  An iterator serves as a pointer into
        the middle of a collection.  When possible, it always points
        to a valid element in the collection (skipping over any
	intermediate nodes that hold no value.<br>
</div>

<pre><span id="TYPEelt"><span class="keyword">type</span> <code class="type">'a</code> elt</span> </pre>
<div class="info">
The type of elements in the collection.<br>
</div>

<pre><span id="TYPEcursor"><span class="keyword">type</span> <code class="type">'a</code> cursor</span> </pre>
<div class="info">
The type of the cursor that points into the collection<br>
</div>

<pre><span id="TYPEcollection"><span class="keyword">type</span> <code class="type">'a</code> collection</span> </pre>
<div class="info">
The type of the collection<br>
</div>

<pre><span id="TYPEdirection"><span class="keyword">type</span> <code class="type"></code>direction</span> </pre>
<div class="info">
A type which guides the order of the traversal.  Different
	collections may support different directions.<br>
</div>

<br><code><span id="TYPEtraversal"><span class="keyword">type</span> <code class="type">'a</code> traversal</span> = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Traverse_All</span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code class="code">Traverse_All</code> will visit every element in the collection.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Traverse_If</span> <span class="keyword">of</span> <code class="type">('a -> bool)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code class="code">Traverse_If f</code> will traverse only those elements for
	    which <code class="code">f</code> returns true.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Traverse_While</span> <span class="keyword">of</span> <code class="type">('a -> bool)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><code class="code">Traverse_While f</code> will traverse elements as long as <code class="code">f</code>
	    is true.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info">
This type defines the traversal strategy.  It determines
	    which elements will be visited by the iterator.<br>
</div>

<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type"><a href="Reins.Iterator.S.html#TYPEdirection">direction</a> -><br>       'a <a href="Reins.Iterator.S.html#TYPEelt">elt</a> <a href="Reins.Iterator.S.html#TYPEtraversal">traversal</a> -><br>       'a <a href="Reins.Iterator.S.html#TYPEcollection">collection</a> -> 'a <a href="Reins.Iterator.S.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">create dir trav col</code> Create an iterator for the collection
	<code class="code">col</code> using the direction and traversal given.<br>
</div>
<pre><span id="VALfrom_cursor"><span class="keyword">val</span> from_cursor</span> : <code class="type"><a href="Reins.Iterator.S.html#TYPEdirection">direction</a> -><br>       'a <a href="Reins.Iterator.S.html#TYPEelt">elt</a> <a href="Reins.Iterator.S.html#TYPEtraversal">traversal</a> -><br>       'a <a href="Reins.Iterator.S.html#TYPEcursor">cursor</a> -> 'a <a href="Reins.Iterator.S.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">from_cursor dir trav curs</code> Create an iterator for the
	collection starting at the cursor <code class="code">curs</code>.  The cursor need not
	point to the beginning of the collection.  If it does point to
	an element, then this element will be the first element
	visited by the iterator.<br>
</div>
<pre><span id="VALvalue"><span class="keyword">val</span> value</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> 'a <a href="Reins.Iterator.S.html#TYPEelt">elt</a> option</code></pre><div class="info">
Return the element currently pointed to by the iterator.  This
	will return <code class="code">None</code> only when the iterator has reached the end
	of the collection.<br>
</div>
<pre><span id="VALget_value"><span class="keyword">val</span> get_value</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> 'a <a href="Reins.Iterator.S.html#TYPEelt">elt</a></code></pre><div class="info">
Similar to <a href="Reins.Iterator.S.html#VALvalue"><code class="code">Reins.Iterator.S.value</code></a> except it throws the exception <code class="code">Failure
	"get_value"</code> if the iterator has reached the end of the
	collection .<br>
</div>
<pre><span id="VALat_end"><span class="keyword">val</span> at_end</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Returns true if the iterator has reached the end of the
	collection as governed by the current traversal strategy.<br>
</div>
<pre><span id="VALat_beg"><span class="keyword">val</span> at_beg</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Returns true if the iterator is at the beginning of the
	collection as governed by the current traversal strategy.
	This is equivalent to <a href="Reins.Iterator.S.html#VALhas_prev"><code class="code">Reins.Iterator.S.has_prev</code></a>.<br>
</div>
<pre><span id="VALhas_next"><span class="keyword">val</span> has_next</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Returns true if there is another element in the traversal
	after the current element.<br>
</div>
<pre><span id="VALnext"><span class="keyword">val</span> next</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> 'a <a href="Reins.Iterator.S.html#TYPEt">t</a></code></pre><div class="info">
Advances the iterator to the next element in the collection.
	If the iterator is at the end of the collection, it raises
	<code class="code">Failure "next"</code>.<br>
</div>
<pre><span id="VALhas_prev"><span class="keyword">val</span> has_prev</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Returns true if there is another element that occurs before
	the current element.  Equivalent to <a href="Reins.Iterator.S.html#VALat_beg"><code class="code">Reins.Iterator.S.at_beg</code></a>.<br>
</div>
<pre><span id="VALprev"><span class="keyword">val</span> prev</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> 'a <a href="Reins.Iterator.S.html#TYPEt">t</a></code></pre><div class="info">
Advances the iterator to the previous element in the
	collection.  If the iterator is at the beginning of the
	collection, it raises <code class="code">Failure "prev"</code>.<br>
</div>
<pre><span id="VALgoto_beg"><span class="keyword">val</span> goto_beg</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> 'a <a href="Reins.Iterator.S.html#TYPEt">t</a></code></pre><div class="info">
Advance the iterator to the beginning of the collection as
	governed by the traversal strategy<br>
</div>
<pre><span id="VALgoto_end"><span class="keyword">val</span> goto_end</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> 'a <a href="Reins.Iterator.S.html#TYPEt">t</a></code></pre><div class="info">
Advance the iterator to the end of the collection as governed
	by the traversal strategy<br>
</div>
<pre><span id="VALflip"><span class="keyword">val</span> flip</span> : <code class="type">'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> 'a <a href="Reins.Iterator.S.html#TYPEt">t</a></code></pre><div class="info">
Reverse the direction of the iterator.  All elements that were
	previously reachable by <code class="code">next</code> are now reachable by <code class="code">prev</code> and
	vice versa.<br>
</div>
<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">('a <a href="Reins.Iterator.S.html#TYPEelt">elt</a> -> unit) -> 'a <a href="Reins.Iterator.S.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">iter f t</code> Apply <code class="code">f</code> to each element in the collection that
	satisfies the traversal strategy.  If the iterator is not at
	the beginning of the collection, the elements reachable by
	<a href="Reins.Iterator.S.html#VALprev"><code class="code">Reins.Iterator.S.prev</code></a> will not be visited.<br>
</div>
<pre><span id="VALfold"><span class="keyword">val</span> fold</span> : <code class="type">('a -> 'b <a href="Reins.Iterator.S.html#TYPEelt">elt</a> -> 'a) -> 'a -> 'b <a href="Reins.Iterator.S.html#TYPEt">t</a> -> 'a</code></pre><div class="info">
<code class="code">fold f acc t</code> Accumulates the result <code class="code">acc</code> by applying <code class="code">f acc
	x</code> for each element <code class="code">x</code> in the collection that satisfies the
	traversal strategy.  If the iterator is not at the beginning
	of the collection, the elements reachable by
	<a href="Reins.Iterator.S.html#VALprev"><code class="code">Reins.Iterator.S.prev</code></a> will not be visited.<br>
</div>
</body></html>