mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
212 lines
No EOL
15 KiB
HTML
212 lines
No EOL
15 KiB
HTML
<!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=utf-8" http-equiv="Content-Type">
|
|
<link rel="Start" href="index.html">
|
|
<link rel="next" href="CCMonadIO.File.html">
|
|
<link rel="Up" href="CCMonadIO.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 methods" rel=Appendix href="index_methods.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="CCVector" rel="Chapter" href="CCVector.html">
|
|
<link title="CCPrint" rel="Chapter" href="CCPrint.html">
|
|
<link title="CCError" rel="Chapter" href="CCError.html">
|
|
<link title="CCHeap" rel="Chapter" href="CCHeap.html">
|
|
<link title="CCList" rel="Chapter" href="CCList.html">
|
|
<link title="CCOpt" rel="Chapter" href="CCOpt.html">
|
|
<link title="CCPair" rel="Chapter" href="CCPair.html">
|
|
<link title="CCFun" rel="Chapter" href="CCFun.html">
|
|
<link title="CCHash" rel="Chapter" href="CCHash.html">
|
|
<link title="CCInt" rel="Chapter" href="CCInt.html">
|
|
<link title="CCBool" rel="Chapter" href="CCBool.html">
|
|
<link title="CCFloat" rel="Chapter" href="CCFloat.html">
|
|
<link title="CCArray" rel="Chapter" href="CCArray.html">
|
|
<link title="CCRef" rel="Chapter" href="CCRef.html">
|
|
<link title="CCSet" rel="Chapter" href="CCSet.html">
|
|
<link title="CCOrd" rel="Chapter" href="CCOrd.html">
|
|
<link title="CCRandom" rel="Chapter" href="CCRandom.html">
|
|
<link title="CCString" rel="Chapter" href="CCString.html">
|
|
<link title="CCHashtbl" rel="Chapter" href="CCHashtbl.html">
|
|
<link title="CCMap" rel="Chapter" href="CCMap.html">
|
|
<link title="CCFormat" rel="Chapter" href="CCFormat.html">
|
|
<link title="CCIO" rel="Chapter" href="CCIO.html">
|
|
<link title="CCInt64" rel="Chapter" href="CCInt64.html">
|
|
<link title="CCChar" rel="Chapter" href="CCChar.html">
|
|
<link title="CCResult" rel="Chapter" href="CCResult.html">
|
|
<link title="Containers" rel="Chapter" href="Containers.html">
|
|
<link title="CCKTree" rel="Chapter" href="CCKTree.html">
|
|
<link title="CCKList" rel="Chapter" href="CCKList.html">
|
|
<link title="CCLazy_list" rel="Chapter" href="CCLazy_list.html">
|
|
<link title="CCMultiMap" rel="Chapter" href="CCMultiMap.html">
|
|
<link title="CCMultiSet" rel="Chapter" href="CCMultiSet.html">
|
|
<link title="CCTrie" rel="Chapter" href="CCTrie.html">
|
|
<link title="CCFlatHashtbl" rel="Chapter" href="CCFlatHashtbl.html">
|
|
<link title="CCCache" rel="Chapter" href="CCCache.html">
|
|
<link title="CCPersistentHashtbl" rel="Chapter" href="CCPersistentHashtbl.html">
|
|
<link title="CCDeque" rel="Chapter" href="CCDeque.html">
|
|
<link title="CCFQueue" rel="Chapter" href="CCFQueue.html">
|
|
<link title="CCBV" rel="Chapter" href="CCBV.html">
|
|
<link title="CCMixtbl" rel="Chapter" href="CCMixtbl.html">
|
|
<link title="CCMixmap" rel="Chapter" href="CCMixmap.html">
|
|
<link title="CCRingBuffer" rel="Chapter" href="CCRingBuffer.html">
|
|
<link title="CCIntMap" rel="Chapter" href="CCIntMap.html">
|
|
<link title="CCPersistentArray" rel="Chapter" href="CCPersistentArray.html">
|
|
<link title="CCMixset" rel="Chapter" href="CCMixset.html">
|
|
<link title="CCHashconsedSet" rel="Chapter" href="CCHashconsedSet.html">
|
|
<link title="CCGraph" rel="Chapter" href="CCGraph.html">
|
|
<link title="CCHashSet" rel="Chapter" href="CCHashSet.html">
|
|
<link title="CCBitField" rel="Chapter" href="CCBitField.html">
|
|
<link title="CCHashTrie" rel="Chapter" href="CCHashTrie.html">
|
|
<link title="CCBloom" rel="Chapter" href="CCBloom.html">
|
|
<link title="CCWBTree" rel="Chapter" href="CCWBTree.html">
|
|
<link title="CCRAL" rel="Chapter" href="CCRAL.html">
|
|
<link title="CCAllocCache" rel="Chapter" href="CCAllocCache.html">
|
|
<link title="CCImmutArray" rel="Chapter" href="CCImmutArray.html">
|
|
<link title="CCHet" rel="Chapter" href="CCHet.html">
|
|
<link title="Containers_string" rel="Chapter" href="Containers_string.html">
|
|
<link title="CCKMP" rel="Chapter" href="CCKMP.html">
|
|
<link title="CCLevenshtein" rel="Chapter" href="CCLevenshtein.html">
|
|
<link title="CCApp_parse" rel="Chapter" href="CCApp_parse.html">
|
|
<link title="CCParse" rel="Chapter" href="CCParse.html">
|
|
<link title="CCBigstring" rel="Chapter" href="CCBigstring.html">
|
|
<link title="CCArray1" rel="Chapter" href="CCArray1.html">
|
|
<link title="CCPool" rel="Chapter" href="CCPool.html">
|
|
<link title="CCLock" rel="Chapter" href="CCLock.html">
|
|
<link title="CCSemaphore" rel="Chapter" href="CCSemaphore.html">
|
|
<link title="CCThread" rel="Chapter" href="CCThread.html">
|
|
<link title="CCBlockingQueue" rel="Chapter" href="CCBlockingQueue.html">
|
|
<link title="CCTimer" rel="Chapter" href="CCTimer.html">
|
|
<link title="Containers_advanced" rel="Chapter" href="Containers_advanced.html">
|
|
<link title="CCLinq" rel="Chapter" href="CCLinq.html">
|
|
<link title="CCBatch" rel="Chapter" href="CCBatch.html">
|
|
<link title="CCCat" rel="Chapter" href="CCCat.html">
|
|
<link title="CCMonadIO" rel="Chapter" href="CCMonadIO.html">
|
|
<link title="Containers_io_is_deprecated" rel="Chapter" href="Containers_io_is_deprecated.html">
|
|
<link title="CCUnix" rel="Chapter" href="CCUnix.html">
|
|
<link title="CCSexp" rel="Chapter" href="CCSexp.html">
|
|
<link title="CCSexpM" rel="Chapter" href="CCSexpM.html"><link title="Consume" rel="Section" href="#6_Consume">
|
|
<link title="Standard Wrappers" rel="Section" href="#6_StandardWrappers">
|
|
<title>Containers doc : CCMonadIO.Seq</title>
|
|
</head>
|
|
<body>
|
|
<div class="navbar"> <a class="up" href="CCMonadIO.html" title="CCMonadIO">Up</a>
|
|
<a class="post" href="CCMonadIO.File.html" title="CCMonadIO.File">Next</a>
|
|
</div>
|
|
<h1>Module <a href="type_CCMonadIO.Seq.html">CCMonadIO.Seq</a></h1>
|
|
|
|
<pre><span class="keyword">module</span> Seq: <code class="code"><span class="keyword">sig</span></code> <a href="CCMonadIO.Seq.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><hr width="100%">
|
|
|
|
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> </pre>
|
|
<div class="info ">
|
|
An IO stream of values of type 'a, consumable (iterable only once)<br>
|
|
</div>
|
|
|
|
|
|
<pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">('a -> 'b <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a>) -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'b <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Map values with actions<br>
|
|
</div>
|
|
|
|
<pre><span id="VALmap_pure"><span class="keyword">val</span> map_pure</span> : <code class="type">('a -> 'b) -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'b <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Map values with a pure function<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfilter_map"><span class="keyword">val</span> filter_map</span> : <code class="type">('a -> 'b option) -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'b <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALfilter"><span class="keyword">val</span> filter</span> : <code class="type">('a -> bool) -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALflat_map"><span class="keyword">val</span> flat_map</span> : <code class="type">('a -> 'b <a href="CCMonadIO.Seq.html#TYPEt">t</a> <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a>) -><br> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'b <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Map each value to a sub sequence of values<br>
|
|
</div>
|
|
|
|
<pre><span id="VALtake"><span class="keyword">val</span> take</span> : <code class="type">int -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALdrop"><span class="keyword">val</span> drop</span> : <code class="type">int -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALtake_while"><span class="keyword">val</span> take_while</span> : <code class="type">('a -> bool <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a>) -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALdrop_while"><span class="keyword">val</span> drop_while</span> : <code class="type">('a -> bool <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a>) -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALgeneral_iter"><span class="keyword">val</span> general_iter</span> : <code class="type">('b -> 'a -> [ `Continue of 'b * 'c option | `Stop ] <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a>) -><br> 'b -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'c <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
<code class="code">general_iter f acc seq</code> performs a <code class="code">filter_map</code> over <code class="code">seq</code>,
|
|
using <code class="code">f</code>. <code class="code">f</code> is given a state and the current value, and
|
|
can either return <code class="code"><span class="keywordsign">`</span><span class="constructor">Stop</span></code> to indicate it stops traversing,
|
|
or <code class="code"><span class="keywordsign">`</span><span class="constructor">Continue</span> (st, c)</code> where <code class="code">st</code> is the new state and
|
|
<code class="code">c</code> an optional output value.
|
|
The result is the stream of values output by <code class="code">f</code><br>
|
|
</div>
|
|
|
|
<pre><span id="VALtee"><span class="keyword">val</span> tee</span> : <code class="type">('a -> unit <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a>) list -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
<code class="code">tee funs seq</code> behaves like <code class="code">seq</code>, but each element is given to
|
|
every function <code class="code">f</code> in <code class="code">funs</code>. This function <code class="code">f</code> returns an action that
|
|
is eagerly executed.<br>
|
|
</div>
|
|
<br>
|
|
<h6 id="6_Consume">Consume</h6><br>
|
|
|
|
<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">('a -> 'b <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a>) -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> unit <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a></code></pre><div class="info ">
|
|
Iterate on the stream, with an action for each element<br>
|
|
</div>
|
|
|
|
<pre><span id="VALlength"><span class="keyword">val</span> length</span> : <code class="type">'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> int <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a></code></pre><div class="info ">
|
|
Length of the stream<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfold"><span class="keyword">val</span> fold</span> : <code class="type">('b -> 'a -> 'b <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a>) -> 'b -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'b <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a></code></pre><div class="info ">
|
|
<code class="code">fold f acc seq</code> folds over <code class="code">seq</code>, consuming it. Every call to <code class="code">f</code>
|
|
has the right to return an IO value.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfold_pure"><span class="keyword">val</span> fold_pure</span> : <code class="type">('b -> 'a -> 'b) -> 'b -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'b <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a></code></pre><div class="info ">
|
|
<code class="code">fold f acc seq</code> folds over <code class="code">seq</code>, consuming it. <code class="code">f</code> is pure.<br>
|
|
</div>
|
|
<br>
|
|
<h6 id="6_StandardWrappers">Standard Wrappers</h6><br>
|
|
|
|
<pre><code><span id="TYPEstep_result"><span class="keyword">type</span> <code class="type">'a</code> step_result</span> = </code></pre><table class="typetable">
|
|
<tr>
|
|
<td align="left" valign="top" >
|
|
<code><span class="keyword">|</span></code></td>
|
|
<td align="left" valign="top" >
|
|
<code><span id="TYPEELTstep_result.Yield"><span class="constructor">Yield</span></span> <span class="keyword">of</span> <code class="type">'a</code></code></td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top" >
|
|
<code><span class="keyword">|</span></code></td>
|
|
<td align="left" valign="top" >
|
|
<code><span id="TYPEELTstep_result.Stop"><span class="constructor">Stop</span></span></code></td>
|
|
|
|
</tr></table>
|
|
|
|
|
|
|
|
<pre><span id="TYPEgen"><span class="keyword">type</span> <code class="type">'a</code> gen</span> = <code class="type">unit -> 'a <a href="CCMonadIO.Seq.html#TYPEstep_result">step_result</a> <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a></code> </pre>
|
|
|
|
|
|
<pre><span id="VALof_fun"><span class="keyword">val</span> of_fun</span> : <code class="type">'a <a href="CCMonadIO.Seq.html#TYPEgen">gen</a> -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Create a stream from a function that yields an element or stops<br>
|
|
</div>
|
|
|
|
<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALsingleton"><span class="keyword">val</span> singleton</span> : <code class="type">'a -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALcons"><span class="keyword">val</span> cons</span> : <code class="type">'a -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALof_list"><span class="keyword">val</span> of_list</span> : <code class="type">'a list -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALof_array"><span class="keyword">val</span> of_array</span> : <code class="type">'a array -> 'a <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALchunks"><span class="keyword">val</span> chunks</span> : <code class="type">size:int -> Pervasives.in_channel -> string <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Read the channel's content into chunks of size <code class="code">size</code><br>
|
|
</div>
|
|
|
|
<pre><span id="VALlines"><span class="keyword">val</span> lines</span> : <code class="type">Pervasives.in_channel -> string <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Lines of an input channel<br>
|
|
</div>
|
|
|
|
<pre><span id="VALwords"><span class="keyword">val</span> words</span> : <code class="type">string <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> string <a href="CCMonadIO.Seq.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Split strings into words at " " boundaries.
|
|
<b>NOT IMPLEMENTED</b><br>
|
|
</div>
|
|
|
|
<pre><span id="VALoutput"><span class="keyword">val</span> output</span> : <code class="type">?sep:string -><br> Pervasives.out_channel -> string <a href="CCMonadIO.Seq.html#TYPEt">t</a> -> unit <a href="CCMonadIO.html#TYPEio">CCMonadIO.io</a></code></pre><div class="info ">
|
|
<code class="code">output oc seq</code> outputs every value of <code class="code">seq</code> into <code class="code">oc</code>, separated
|
|
with the optional argument <code class="code">sep</code> (default: None).
|
|
It blocks until all values of <code class="code">seq</code> are produced and written to <code class="code">oc</code>.<br>
|
|
</div>
|
|
</body></html> |