Sophie

Sophie

distrib > Mageia > 3 > i586 > by-pkgid > 201a9f979540fcfb8136ebdbfe063650 > files > 50

ocaml-lwt-doc-2.4.2-5.mga3.i586.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="previous" href="Lwt_pool.html">
<link rel="next" href="Lwt_stream.html">
<link rel="Up" href="index.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 class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of class types" rel=Appendix href="index_class_types.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="Lwt_condition" rel="Chapter" href="Lwt_condition.html">
<link title="Lwt_list" rel="Chapter" href="Lwt_list.html">
<link title="Lwt" rel="Chapter" href="Lwt.html">
<link title="Lwt_mutex" rel="Chapter" href="Lwt_mutex.html">
<link title="Lwt_mvar" rel="Chapter" href="Lwt_mvar.html">
<link title="Lwt_pool" rel="Chapter" href="Lwt_pool.html">
<link title="Lwt_sequence" rel="Chapter" href="Lwt_sequence.html">
<link title="Lwt_stream" rel="Chapter" href="Lwt_stream.html">
<link title="Lwt_switch" rel="Chapter" href="Lwt_switch.html">
<link title="Lwt_util" rel="Chapter" href="Lwt_util.html">
<link title="Lwt_pqueue" rel="Chapter" href="Lwt_pqueue.html">
<link title="Lwt_lib" rel="Chapter" href="Lwt_lib.html">
<link title="Lwt_glib" rel="Chapter" href="Lwt_glib.html">
<link title="Lwt_preemptive" rel="Chapter" href="Lwt_preemptive.html">
<link title="Lwt_event" rel="Chapter" href="Lwt_event.html">
<link title="Lwt_signal" rel="Chapter" href="Lwt_signal.html">
<link title="Lwt_react" rel="Chapter" href="Lwt_react.html">
<link title="Lwt_ssl" rel="Chapter" href="Lwt_ssl.html">
<link title="Lwt_text" rel="Chapter" href="Lwt_text.html">
<link title="Lwt_term" rel="Chapter" href="Lwt_term.html">
<link title="Lwt_read_line" rel="Chapter" href="Lwt_read_line.html">
<link title="Lwt_top" rel="Chapter" href="Lwt_top.html">
<link title="Lwt_chan" rel="Chapter" href="Lwt_chan.html">
<link title="Lwt_daemon" rel="Chapter" href="Lwt_daemon.html">
<link title="Lwt_gc" rel="Chapter" href="Lwt_gc.html">
<link title="Lwt_io" rel="Chapter" href="Lwt_io.html">
<link title="Lwt_log" rel="Chapter" href="Lwt_log.html">
<link title="Lwt_main" rel="Chapter" href="Lwt_main.html">
<link title="Lwt_process" rel="Chapter" href="Lwt_process.html">
<link title="Lwt_throttle" rel="Chapter" href="Lwt_throttle.html">
<link title="Lwt_timeout" rel="Chapter" href="Lwt_timeout.html">
<link title="Lwt_unix" rel="Chapter" href="Lwt_unix.html">
<link title="Lwt_sys" rel="Chapter" href="Lwt_sys.html">
<link title="Lwt_engine" rel="Chapter" href="Lwt_engine.html">
<link title="Lwt_bytes" rel="Chapter" href="Lwt_bytes.html">
<link title="Pa_lwt" rel="Chapter" href="Pa_lwt.html">
<link title="Pa_lwt_log" rel="Chapter" href="Pa_lwt_log.html"><link title="Operation on nodes" rel="Section" href="#6_Operationonnodes">
<link title="Operations on sequence" rel="Section" href="#6_Operationsonsequence">
<link title="Sequence iterators" rel="Section" href="#6_Sequenceiterators">
<title>Lwt_sequence</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Lwt_pool.html" title="Lwt_pool">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Lwt_stream.html" title="Lwt_stream">Next</a>
</div>
<h1>Module <a href="type_Lwt_sequence.html">Lwt_sequence</a></h1>
<pre><span class="keyword">module</span> Lwt_sequence: <code class="code"><span class="keyword">sig</span></code> <a href="Lwt_sequence.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Mutable sequence of elements<br>
</div>
<hr width="100%">
<br>
A sequence is an object holding a list of elements which support
    the following operations:
<p>
<ul>
<li>adding an element to the left or the right in time and space O(1)</li>
<li>taking an element from the left or the right in time and space O(1)</li>
<li>removing a previously added element from a sequence in time and space O(1)</li>
<li>removing an element while the sequence is being transversed.</li>
</ul>
<br>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> </pre>
<div class="info">
Type of a sequence holding values of type <code class="code"><span class="keywordsign">'</span>a</code><br>
</div>

<pre><span id="TYPEnode"><span class="keyword">type</span> <code class="type">'a</code> node</span> </pre>
<div class="info">
Type of a node holding one value of type <code class="code"><span class="keywordsign">'</span>a</code> in a sequence<br>
</div>

<br>
<h6 id="6_Operationonnodes">Operation on nodes</h6><br>
<pre><span id="VALget"><span class="keyword">val</span> get</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEnode">node</a> -> 'a</code></pre><div class="info">
Returns the contents of a node<br>
</div>
<pre><span id="VALset"><span class="keyword">val</span> set</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEnode">node</a> -> 'a -> unit</code></pre><div class="info">
Change the contents of a node<br>
</div>
<pre><span id="VALremove"><span class="keyword">val</span> remove</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEnode">node</a> -> unit</code></pre><div class="info">
Removes a node from the sequence it is part of. It does nothing
      if the node has already been removed.<br>
</div>
<br>
<h6 id="6_Operationsonsequence">Operations on sequence</h6><br>
<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">unit -> 'a <a href="Lwt_sequence.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">create ()</code> creates a new empty sequence<br>
</div>
<pre><span id="VALis_empty"><span class="keyword">val</span> is_empty</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Returns <code class="code"><span class="keyword">true</span></code> iff the given sequence is empty<br>
</div>
<pre><span id="VALlength"><span class="keyword">val</span> length</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEt">t</a> -> int</code></pre><div class="info">
Returns the number of elemenets in the given sequence. This is a
      O(n) operation where <code class="code">n</code> is the number of elements in the
      sequence.<br>
</div>
<pre><span id="VALadd_l"><span class="keyword">val</span> add_l</span> : <code class="type">'a -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'a <a href="Lwt_sequence.html#TYPEnode">node</a></code></pre><div class="info">
<code class="code">add_l x s</code> adds <code class="code">x</code> to the left of the sequence <code class="code">s</code><br>
</div>
<pre><span id="VALadd_r"><span class="keyword">val</span> add_r</span> : <code class="type">'a -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'a <a href="Lwt_sequence.html#TYPEnode">node</a></code></pre><div class="info">
<code class="code">add_l x s</code> adds <code class="code">x</code> to the right of the sequence <code class="code">s</code><br>
</div>
<pre><span id="EXCEPTIONEmpty"><span class="keyword">exception</span> Empty</span></pre>
<div class="info">
Exception raised by <code class="code">take_l</code> and <code class="code">tale_s</code> and when the sequence
      is empty<br>
</div>
<pre><span id="VALtake_l"><span class="keyword">val</span> take_l</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'a</code></pre><div class="info">
<code class="code">take_l x s</code> remove and returns the leftmost element of <code class="code">s</code><br>
<b>Raises</b> <code>Empty</code> if the sequence is empty<br>
</div>
<pre><span id="VALtake_r"><span class="keyword">val</span> take_r</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'a</code></pre><div class="info">
<code class="code">take_l x s</code> remove and returns the rightmost element of <code class="code">s</code><br>
<b>Raises</b> <code>Empty</code> if the sequence is empty<br>
</div>
<pre><span id="VALtake_opt_l"><span class="keyword">val</span> take_opt_l</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'a option</code></pre><div class="info">
<code class="code">take_opt_l x s</code> remove and returns <code class="code"><span class="constructor">Some</span> x</code> where <code class="code">x</code> is the
      leftmost element of <code class="code">s</code> or <code class="code"><span class="constructor">None</span></code> if <code class="code">s</code> is empty<br>
</div>
<pre><span id="VALtake_opt_r"><span class="keyword">val</span> take_opt_r</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'a option</code></pre><div class="info">
<code class="code">take_opt_l x s</code> remove and returns <code class="code"><span class="constructor">Some</span> x</code> where <code class="code">x</code> is the
      rightmost element of <code class="code">s</code> or <code class="code"><span class="constructor">None</span></code> if <code class="code">s</code> is empty<br>
</div>
<pre><span id="VALtransfer_l"><span class="keyword">val</span> transfer_l</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">transfer_l s1 s2</code> removes all elements of <code class="code">s1</code> and add them at
      the left of <code class="code">s2</code>. This operation runs in constant time and
      space.<br>
</div>
<pre><span id="VALtransfer_r"><span class="keyword">val</span> transfer_r</span> : <code class="type">'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">transfer_r s1 s2</code> removes all elements of <code class="code">s1</code> and add them at
      the right of <code class="code">s2</code>. This operation runs in constant time and
      space.<br>
</div>
<br>
<h6 id="6_Sequenceiterators">Sequence iterators</h6><br>
<br>
Note: it is OK to remove a node while traversing a sequence<br>
<pre><span id="VALiter_l"><span class="keyword">val</span> iter_l</span> : <code class="type">('a -> unit) -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">iter_l f s</code> applies <code class="code">f</code> on all elements of <code class="code">s</code> starting from
      the left<br>
</div>
<pre><span id="VALiter_r"><span class="keyword">val</span> iter_r</span> : <code class="type">('a -> unit) -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">iter_l f s</code> applies <code class="code">f</code> on all elements of <code class="code">s</code> starting from
      the right<br>
</div>
<pre><span id="VALiter_node_l"><span class="keyword">val</span> iter_node_l</span> : <code class="type">('a <a href="Lwt_sequence.html#TYPEnode">node</a> -> unit) -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">iter_l f s</code> applies <code class="code">f</code> on all nodes of <code class="code">s</code> starting from
      the left<br>
</div>
<pre><span id="VALiter_node_r"><span class="keyword">val</span> iter_node_r</span> : <code class="type">('a <a href="Lwt_sequence.html#TYPEnode">node</a> -> unit) -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">iter_l f s</code> applies <code class="code">f</code> on all nodes of <code class="code">s</code> starting from
      the right<br>
</div>
<pre><span id="VALfold_l"><span class="keyword">val</span> fold_l</span> : <code class="type">('a -> 'b -> 'b) -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'b -> 'b</code></pre><div class="info">
<code class="code">fold_l f s</code> is:
      <pre class="codepre"><code class="code">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fold_l&nbsp;f&nbsp;s&nbsp;x&nbsp;=&nbsp;f&nbsp;en&nbsp;(...&nbsp;(f&nbsp;e2&nbsp;(f&nbsp;e1&nbsp;x)))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></pre>
      where <code class="code">e1</code>, <code class="code">e2</code>, ..., <code class="code">en</code> are the elements of <code class="code">s</code><br>
</div>
<pre><span id="VALfold_r"><span class="keyword">val</span> fold_r</span> : <code class="type">('a -> 'b -> 'b) -> 'a <a href="Lwt_sequence.html#TYPEt">t</a> -> 'b -> 'b</code></pre><div class="info">
<code class="code">fold_r f s</code> is:
      <pre class="codepre"><code class="code">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fold_r&nbsp;f&nbsp;s&nbsp;x&nbsp;=&nbsp;f&nbsp;e1&nbsp;(f&nbsp;e2&nbsp;(...&nbsp;(f&nbsp;en&nbsp;x)))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></pre>
      where <code class="code">e1</code>, <code class="code">e2</code>, ..., <code class="code">en</code> are the elements of <code class="code">s</code><br>
</div>
</body></html>