ocaml-containers/1.1/CCFQueue.html
2017-05-01 17:08:30 +02:00

244 lines
No EOL
17 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="previous" href="CCDeque.html">
<link rel="next" href="CCBV.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 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="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="CCParse" rel="Chapter" href="CCParse.html">
<link title="CCArray_slice" rel="Chapter" href="CCArray_slice.html">
<link title="CCListLabels" rel="Chapter" href="CCListLabels.html">
<link title="CCArrayLabels" rel="Chapter" href="CCArrayLabels.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="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="CCWBTree" rel="Chapter" href="CCWBTree.html">
<link title="CCRAL" rel="Chapter" href="CCRAL.html">
<link title="CCImmutArray" rel="Chapter" href="CCImmutArray.html">
<link title="CCHet" rel="Chapter" href="CCHet.html">
<link title="CCZipper" rel="Chapter" href="CCZipper.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="CCUnix" rel="Chapter" href="CCUnix.html">
<link title="CCSexp" rel="Chapter" href="CCSexp.html">
<link title="CCSexp_lex" rel="Chapter" href="CCSexp_lex.html"><link title="Basics" rel="Section" href="#2_Basics">
<link title="Individual extraction" rel="Section" href="#2_Individualextraction">
<link title="Global Operations" rel="Section" href="#2_GlobalOperations">
<link title="Conversions" rel="Section" href="#2_Conversions">
<title>Containers doc : CCFQueue</title>
</head>
<body>
<div class="navbar"><a class="pre" href="CCDeque.html" title="CCDeque">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="CCBV.html" title="CCBV">Next</a>
</div>
<h1>Module <a href="type_CCFQueue.html">CCFQueue</a></h1>
<pre><span class="keyword">module</span> CCFQueue: <code class="code"><span class="keyword">sig</span></code> <a href="CCFQueue.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
<h1 id="1_Functionalqueues">Functional queues</h1><br>
</div>
<hr width="100%">
<pre><span id="TYPEsequence"><span class="keyword">type</span> <code class="type">'a</code> sequence</span> = <code class="type">('a -> unit) -> unit</code> </pre>
<pre><span id="TYPEklist"><span class="keyword">type</span> <code class="type">'a</code> klist</span> = <code class="type">unit -> [ `Cons of 'a * 'a <a href="CCFQueue.html#TYPEklist">klist</a> | `Nil ]</code> </pre>
<pre><span id="TYPEequal"><span class="keyword">type</span> <code class="type">'a</code> equal</span> = <code class="type">'a -> 'a -> bool</code> </pre>
<pre><span id="TYPEprinter"><span class="keyword">type</span> <code class="type">'a</code> printer</span> = <code class="type">Format.formatter -> 'a -> unit</code> </pre>
<br>
<h2 id="2_Basics">Basics</h2><br>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">+'a</code> t</span> </pre>
<div class="info ">
Queue containing elements of type 'a<br>
</div>
<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="VALis_empty"><span class="keyword">val</span> is_empty</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> bool</code></pre>
<pre><span id="VALsingleton"><span class="keyword">val</span> singleton</span> : <code class="type">'a -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="VALdoubleton"><span class="keyword">val</span> doubleton</span> : <code class="type">'a -> 'a -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="EXCEPTIONEmpty"><span class="keyword">exception</span> Empty</span></pre>
<pre><span id="VALcons"><span class="keyword">val</span> cons</span> : <code class="type">'a -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Push element at the front of the queue<br>
</div>
<pre><span id="VALsnoc"><span class="keyword">val</span> snoc</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Push element at the end of the queue<br>
</div>
<pre><span id="VALtake_front"><span class="keyword">val</span> take_front</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> ('a * 'a <a href="CCFQueue.html#TYPEt">t</a>) option</code></pre><div class="info ">
Get and remove the first element<br>
</div>
<pre><span id="VALtake_front_exn"><span class="keyword">val</span> take_front_exn</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a * 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Same as <a href="CCFQueue.html#VALtake_front"><code class="code"><span class="constructor">CCFQueue</span>.take_front</code></a>, but fails on empty queues.<br>
<b>Raises</b> <code>Empty</code> if the queue is empty<br>
</div>
<pre><span id="VALtake_front_l"><span class="keyword">val</span> take_front_l</span> : <code class="type">int -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a list * 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">take_front_l n q</code> takes at most <code class="code">n</code> elements from the front
of <code class="code">q</code>, and returns them wrapped in a list<br>
</div>
<pre><span id="VALtake_front_while"><span class="keyword">val</span> take_front_while</span> : <code class="type">('a -> bool) -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a list * 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="VALtake_back"><span class="keyword">val</span> take_back</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> ('a <a href="CCFQueue.html#TYPEt">t</a> * 'a) option</code></pre><div class="info ">
Take last element<br>
</div>
<pre><span id="VALtake_back_exn"><span class="keyword">val</span> take_back_exn</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a> * 'a</code></pre>
<pre><span id="VALtake_back_l"><span class="keyword">val</span> take_back_l</span> : <code class="type">int -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a> * 'a list</code></pre><div class="info ">
<code class="code">take_back_l n q</code> removes and returns the last <code class="code">n</code> elements of <code class="code">q</code>. The
elements are in the order of the queue, that is, the head of the returned
list is the first element to appear via <a href="CCFQueue.html#VALtake_front"><code class="code"><span class="constructor">CCFQueue</span>.take_front</code></a>.
<code class="code">take_back_l 2 (of_list [1;2;3;4]) = of_list [1;2], [3;4]</code><br>
</div>
<pre><span id="VALtake_back_while"><span class="keyword">val</span> take_back_while</span> : <code class="type">('a -> bool) -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a> * 'a list</code></pre><br>
<h2 id="2_Individualextraction">Individual extraction</h2><br>
<pre><span id="VALfirst"><span class="keyword">val</span> first</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
First element of the queue<br>
</div>
<pre><span id="VALlast"><span class="keyword">val</span> last</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
Last element of the queue<br>
</div>
<pre><span id="VALfirst_exn"><span class="keyword">val</span> first_exn</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a</code></pre><div class="info ">
Same as <a href="CCFQueue.html#VALfirst"><code class="code"><span class="constructor">CCFQueue</span>.first</code></a> but<br>
<b>Raises</b> <code>Empty</code> if the queue is empty<br>
</div>
<pre><span id="VALlast_exn"><span class="keyword">val</span> last_exn</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a</code></pre>
<pre><span id="VALnth"><span class="keyword">val</span> nth</span> : <code class="type">int -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
Return the <code class="code">i</code>-th element of the queue in logarithmic time<br>
</div>
<pre><span id="VALnth_exn"><span class="keyword">val</span> nth_exn</span> : <code class="type">int -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a</code></pre><div class="info ">
Unsafe version of <a href="CCFQueue.html#VALnth"><code class="code"><span class="constructor">CCFQueue</span>.nth</code></a><br>
<b>Raises</b> <code>Not_found</code> if the index is wrong<br>
</div>
<pre><span id="VALtail"><span class="keyword">val</span> tail</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Queue deprived of its first element. Does nothing on empty queues<br>
</div>
<pre><span id="VALinit"><span class="keyword">val</span> init</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Queue deprived of its last element. Does nothing on empty queues<br>
</div>
<br>
<h2 id="2_GlobalOperations">Global Operations</h2><br>
<pre><span id="VALappend"><span class="keyword">val</span> append</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Append two queues. Elements from the second one come
after elements of the first one.
Linear in the size of the second queue.<br>
</div>
<pre><span id="VALrev"><span class="keyword">val</span> rev</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Reverse the queue, O(n) complexity<br>
<b>Since</b> 0.10<br>
</div>
<pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">('a -> 'b) -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'b <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Map values<br>
</div>
<pre><span id="VAL(>|=)"><span class="keyword">val</span> (&gt;|=)</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> ('a -> 'b) -> 'b <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
Synonym to <a href="CCFQueue.html#VALmap"><code class="code"><span class="constructor">CCFQueue</span>.map</code></a><br>
</div>
<pre><span id="VALsize"><span class="keyword">val</span> size</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> int</code></pre><div class="info ">
Number of elements in the queue (constant time)<br>
</div>
<pre><span id="VALfold"><span class="keyword">val</span> fold</span> : <code class="type">('b -> 'a -> 'b) -> 'b -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'b</code></pre>
<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">('a -> unit) -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> unit</code></pre>
<pre><span id="VALequal"><span class="keyword">val</span> equal</span> : <code class="type">'a <a href="CCFQueue.html#TYPEequal">equal</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a> <a href="CCFQueue.html#TYPEequal">equal</a></code></pre><br>
<h2 id="2_Conversions">Conversions</h2><br>
<pre><span id="VALof_list"><span class="keyword">val</span> of_list</span> : <code class="type">'a list -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="VALto_list"><span class="keyword">val</span> to_list</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a list</code></pre>
<pre><span id="VALadd_seq_front"><span class="keyword">val</span> add_seq_front</span> : <code class="type">'a <a href="CCFQueue.html#TYPEsequence">sequence</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="VALadd_seq_back"><span class="keyword">val</span> add_seq_back</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEsequence">sequence</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="VALto_seq"><span class="keyword">val</span> to_seq</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEsequence">sequence</a></code></pre>
<pre><span id="VALof_seq"><span class="keyword">val</span> of_seq</span> : <code class="type">'a <a href="CCFQueue.html#TYPEsequence">sequence</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="VALto_klist"><span class="keyword">val</span> to_klist</span> : <code class="type">'a <a href="CCFQueue.html#TYPEt">t</a> -> 'a <a href="CCFQueue.html#TYPEklist">klist</a></code></pre>
<pre><span id="VALof_klist"><span class="keyword">val</span> of_klist</span> : <code class="type">'a <a href="CCFQueue.html#TYPEklist">klist</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a></code></pre>
<pre><span id="VAL(--)"><span class="keyword">val</span> (--)</span> : <code class="type">int -> int -> int <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">a -- b</code> is the integer range from <code class="code">a</code> to <code class="code">b</code>, both included.<br>
<b>Since</b> 0.10<br>
</div>
<pre><span id="VAL(--^)"><span class="keyword">val</span> (--^)</span> : <code class="type">int -> int -> int <a href="CCFQueue.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">a -- b</code> is the integer range from <code class="code">a</code> to <code class="code">b</code>, where <code class="code">b</code> is excluded.<br>
<b>Since</b> 0.17<br>
</div>
<pre><span id="VALprint"><span class="keyword">val</span> print</span> : <code class="type">'a <a href="CCFQueue.html#TYPEprinter">printer</a> -> 'a <a href="CCFQueue.html#TYPEt">t</a> <a href="CCFQueue.html#TYPEprinter">printer</a></code></pre><div class="info ">
<b>Since</b> 0.13<br>
</div>
</body></html>