mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
434 lines
No EOL
30 KiB
HTML
434 lines
No EOL
30 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="CCHeap.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"><title>Containers doc : CCVector</title>
|
|
</head>
|
|
<body>
|
|
<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a>
|
|
<a class="post" href="CCHeap.html" title="CCHeap">Next</a>
|
|
</div>
|
|
<h1>Module <a href="type_CCVector.html">CCVector</a></h1>
|
|
|
|
<pre><span class="keyword">module</span> CCVector: <code class="code"><span class="keyword">sig</span></code> <a href="CCVector.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
|
|
<h1 id="1_Growablemutablevector">Growable, mutable vector</h1><br>
|
|
</div>
|
|
<hr width="100%">
|
|
|
|
<pre><span id="TYPEro"><span class="keyword">type</span> <code class="type"></code>ro</span> = <code class="type">[ `RO ]</code> </pre>
|
|
|
|
|
|
<pre><span id="TYPErw"><span class="keyword">type</span> <code class="type"></code>rw</span> = <code class="type">[ `RW ]</code> </pre>
|
|
|
|
<br>
|
|
Mutability is <code class="code">rw</code> (read-write) or <code class="code">ro</code> (read-only)<br>
|
|
|
|
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">('a, 'mut)</code> t</span> </pre>
|
|
<div class="info ">
|
|
The type of a vector of elements of type <code class="code"><span class="keywordsign">'</span>a</code>, with
|
|
a mutability flat <code class="code"><span class="keywordsign">'</span>mut</code><br>
|
|
</div>
|
|
|
|
|
|
<pre><span id="TYPEvector"><span class="keyword">type</span> <code class="type">'a</code> vector</span> = <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a></code> </pre>
|
|
<div class="info ">
|
|
Type synonym: a <code class="code"><span class="keywordsign">'</span>a vector</code> is mutable.<br>
|
|
</div>
|
|
|
|
|
|
<pre><span id="TYPEro_vector"><span class="keyword">type</span> <code class="type">'a</code> ro_vector</span> = <code class="type">('a, <a href="CCVector.html#TYPEro">ro</a>) <a href="CCVector.html#TYPEt">t</a></code> </pre>
|
|
<div class="info ">
|
|
Alias for immutable vectors.<br>
|
|
<b>Since</b> 0.15<br>
|
|
</div>
|
|
|
|
|
|
<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="CCVector.html#TYPEklist">klist</a> | `Nil ]</code> </pre>
|
|
|
|
|
|
<pre><span id="TYPEgen"><span class="keyword">type</span> <code class="type">'a</code> gen</span> = <code class="type">unit -> 'a option</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="TYPEord"><span class="keyword">type</span> <code class="type">'a</code> ord</span> = <code class="type">'a -> 'a -> int</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>
|
|
|
|
|
|
<pre><span id="VALfreeze"><span class="keyword">val</span> freeze</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> ('a, <a href="CCVector.html#TYPEro">ro</a>) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Make an immutable vector (no copy! Don't use the old version)<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfreeze_copy"><span class="keyword">val</span> freeze_copy</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> ('a, <a href="CCVector.html#TYPEro">ro</a>) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Copy the vector into an immutable version<br>
|
|
</div>
|
|
|
|
<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">unit -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Create a new, empty vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALcreate_with"><span class="keyword">val</span> create_with</span> : <code class="type">?capacity:int -> 'a -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Create a new vector, using the given value as a filler.<br>
|
|
</div>
|
|
<div class="param_info"><code class="code">capacity</code> : the size of the underlying array
|
|
<b>caution</b>: the value will likely not be GC'd before the vector is.</div>
|
|
|
|
<pre><span id="VALreturn"><span class="keyword">val</span> return</span> : <code class="type">'a -> ('a, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Singleton vector<br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
|
|
<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">int -> 'a -> ('a, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
<code class="code">make n x</code> makes a vector of size <code class="code">n</code>, filled with <code class="code">x</code><br>
|
|
</div>
|
|
|
|
<pre><span id="VALinit"><span class="keyword">val</span> init</span> : <code class="type">int -> (int -> 'a) -> ('a, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Init the vector with the given function and size<br>
|
|
</div>
|
|
|
|
<pre><span id="VALclear"><span class="keyword">val</span> clear</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
Clear the content of the vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALensure_with"><span class="keyword">val</span> ensure_with</span> : <code class="type">init:'a -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info ">
|
|
Hint to the vector that it should have at least the given capacity.<br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
<div class="param_info"><code class="code">init</code> : if <code class="code">capacity v = 0</code>, used as a filler
|
|
element for the underlying array (see <a href="CCVector.html#VALcreate_with"><code class="code"><span class="constructor">CCVector</span>.create_with</code></a>)</div>
|
|
|
|
<pre><span id="VALensure"><span class="keyword">val</span> ensure</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info ">
|
|
Hint to the vector that it should have at least the given capacity.
|
|
Just a hint, will not be enforced if the vector is empty and <code class="code">init</code>
|
|
is not provided.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALis_empty"><span class="keyword">val</span> is_empty</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
|
|
Is the vector empty?<br>
|
|
</div>
|
|
|
|
<pre><span id="VALpush"><span class="keyword">val</span> push</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a -> unit</code></pre><div class="info ">
|
|
Add an element at the end of the vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALappend"><span class="keyword">val</span> append</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
<code class="code">append a b</code> adds all elements of b to a<br>
|
|
</div>
|
|
|
|
<pre><span id="VALappend_array"><span class="keyword">val</span> append_array</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a array -> unit</code></pre><div class="info ">
|
|
Same as append, with an array<br>
|
|
</div>
|
|
|
|
<pre><span id="VALappend_seq"><span class="keyword">val</span> append_seq</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a <a href="CCVector.html#TYPEsequence">sequence</a> -> unit</code></pre><div class="info ">
|
|
Append content of sequence<br>
|
|
</div>
|
|
|
|
<pre><span id="VALappend_list"><span class="keyword">val</span> append_list</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a list -> unit</code></pre><div class="info ">
|
|
Append content of list<br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
|
|
<pre><span id="VALappend_gen"><span class="keyword">val</span> append_gen</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a <a href="CCVector.html#TYPEgen">gen</a> -> unit</code></pre><div class="info ">
|
|
Append content of generator<br>
|
|
<b>Since</b> 0.20<br>
|
|
</div>
|
|
|
|
<pre><span id="VALequal"><span class="keyword">val</span> equal</span> : <code class="type">'a <a href="CCVector.html#TYPEequal">equal</a> -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> <a href="CCVector.html#TYPEequal">equal</a></code></pre>
|
|
<pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type">'a <a href="CCVector.html#TYPEord">ord</a> -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> <a href="CCVector.html#TYPEord">ord</a></code></pre><div class="info ">
|
|
Total ordering on vectors. Lexicographic comparison.<br>
|
|
</div>
|
|
|
|
<pre><span id="EXCEPTIONEmpty"><span class="keyword">exception</span> Empty</span></pre>
|
|
<div class="info ">
|
|
Raised on empty stack<br>
|
|
</div>
|
|
|
|
<pre><span id="VALpop"><span class="keyword">val</span> pop</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
|
|
Remove last element, or <code class="code"><span class="constructor">None</span></code><br>
|
|
</div>
|
|
|
|
<pre><span id="VALpop_exn"><span class="keyword">val</span> pop_exn</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a</code></pre><div class="info ">
|
|
Remove last element, or raise a Failure if empty<br>
|
|
<b>Raises</b> <code>Empty</code> on an empty vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALtop"><span class="keyword">val</span> top</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
|
|
Top element, if present<br>
|
|
<b>Since</b> 0.6<br>
|
|
</div>
|
|
|
|
<pre><span id="VALtop_exn"><span class="keyword">val</span> top_exn</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a</code></pre><div class="info ">
|
|
Top element, if present<br>
|
|
<b>Since</b> 0.6<br>
|
|
<b>Raises</b> <code>Empty</code> on an empty vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALcopy"><span class="keyword">val</span> copy</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> ('a, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Shallow copy (may give an immutable or mutable vector)<br>
|
|
</div>
|
|
|
|
<pre><span id="VALshrink"><span class="keyword">val</span> shrink</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info ">
|
|
Shrink to the given size (remove elements above this size).
|
|
Does nothing if the parameter is bigger than the current size.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALmember"><span class="keyword">val</span> member</span> : <code class="type">?eq:('a -> 'a -> bool) -> 'a -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
|
|
Is the element a member of the vector?<br>
|
|
</div>
|
|
|
|
<pre><span id="VALsort"><span class="keyword">val</span> sort</span> : <code class="type">('a -> 'a -> int) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> ('a, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Sort the vector, returning a copy of it that is sorted
|
|
w.r.t the given ordering. The vector itself is unchanged.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALsort'"><span class="keyword">val</span> sort'</span> : <code class="type">('a -> 'a -> int) -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
Sort the vector in place (modifying it).<br>
|
|
</div>
|
|
|
|
<pre><span id="VALuniq_sort"><span class="keyword">val</span> uniq_sort</span> : <code class="type">('a -> 'a -> int) -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
Sort the array and remove duplicates, in place (e.g. modifying
|
|
the vector itself)<br>
|
|
</div>
|
|
|
|
<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">('a -> unit) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
Iterate on the vector's content<br>
|
|
</div>
|
|
|
|
<pre><span id="VALiteri"><span class="keyword">val</span> iteri</span> : <code class="type">(int -> 'a -> unit) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
Iterate on the vector, with indexes<br>
|
|
</div>
|
|
|
|
<pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">('a -> 'b) -> ('a, 'c) <a href="CCVector.html#TYPEt">t</a> -> ('b, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Map elements of the vector, yielding a new vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfilter"><span class="keyword">val</span> filter</span> : <code class="type">('a -> bool) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> ('a, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Filter elements from the vector. <code class="code">filter p v</code> leaves <code class="code">v</code> unchanged but
|
|
returns a new vector that only contains elements of <code class="code">v</code> satisfying <code class="code">p</code>.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfilter'"><span class="keyword">val</span> filter'</span> : <code class="type">('a -> bool) -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
Filter elements in place.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfold"><span class="keyword">val</span> fold</span> : <code class="type">('b -> 'a -> 'b) -> 'b -> ('a, 'c) <a href="CCVector.html#TYPEt">t</a> -> 'b</code></pre><div class="info ">
|
|
Fold on elements of the vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALexists"><span class="keyword">val</span> exists</span> : <code class="type">('a -> bool) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
|
|
Existential test (is there an element that satisfies the predicate?)<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfor_all"><span class="keyword">val</span> for_all</span> : <code class="type">('a -> bool) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
|
|
Universal test (do all the elements satisfy the predicate?)<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfind"><span class="keyword">val</span> find</span> : <code class="type">('a -> bool) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a option</code></pre><div class="info ">
|
|
Find an element that satisfies the predicate<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfind_exn"><span class="keyword">val</span> find_exn</span> : <code class="type">('a -> bool) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a</code></pre><div class="info ">
|
|
Find an element that satisfies the predicate, or<br>
|
|
<b>Raises</b> <code>Not_found</code> if no element does<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfind_map"><span class="keyword">val</span> find_map</span> : <code class="type">('a -> 'b option) -> ('a, 'c) <a href="CCVector.html#TYPEt">t</a> -> 'b option</code></pre><div class="info ">
|
|
<code class="code">find_map f v</code> returns the first <code class="code"><span class="constructor">Some</span> y = f x</code> for <code class="code">x</code> in <code class="code">v</code>,
|
|
or <code class="code"><span class="constructor">None</span></code> if <code class="code">f x = <span class="constructor">None</span></code> for each <code class="code">x</code> in <code class="code">v</code><br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
|
|
<pre><span id="VALfilter_map"><span class="keyword">val</span> filter_map</span> : <code class="type">('a -> 'b option) -> ('a, 'c) <a href="CCVector.html#TYPEt">t</a> -> ('b, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Map elements with a function, possibly filtering some of them out<br>
|
|
</div>
|
|
|
|
<pre><span id="VALflat_map"><span class="keyword">val</span> flat_map</span> : <code class="type">('a -> ('b, 'c) <a href="CCVector.html#TYPEt">t</a>) -> ('a, 'd) <a href="CCVector.html#TYPEt">t</a> -> ('b, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Map each element to a sub-vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALflat_map_seq"><span class="keyword">val</span> flat_map_seq</span> : <code class="type">('a -> 'b <a href="CCVector.html#TYPEsequence">sequence</a>) -> ('a, 'c) <a href="CCVector.html#TYPEt">t</a> -> ('b, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Like <a href="CCVector.html#VALflat_map"><code class="code"><span class="constructor">CCVector</span>.flat_map</code></a>, but using <a href="CCVector.html#TYPEsequence"><code class="code"><span class="constructor">CCVector</span>.sequence</code></a> for
|
|
intermediate collections.<br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
|
|
<pre><span id="VALflat_map_list"><span class="keyword">val</span> flat_map_list</span> : <code class="type">('a -> 'b list) -> ('a, 'c) <a href="CCVector.html#TYPEt">t</a> -> ('b, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Like <a href="CCVector.html#VALflat_map"><code class="code"><span class="constructor">CCVector</span>.flat_map</code></a>, but using <code class="code">list</code> for
|
|
intermediate collections.<br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
|
|
<pre><span id="VAL(>>=)"><span class="keyword">val</span> (>>=)</span> : <code class="type">('a, 'c) <a href="CCVector.html#TYPEt">t</a> -> ('a -> ('b, 'd) <a href="CCVector.html#TYPEt">t</a>) -> ('b, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Infix version of <a href="CCVector.html#VALflat_map"><code class="code"><span class="constructor">CCVector</span>.flat_map</code></a><br>
|
|
</div>
|
|
|
|
<pre><span id="VAL(>|=)"><span class="keyword">val</span> (>|=)</span> : <code class="type">('a, 'c) <a href="CCVector.html#TYPEt">t</a> -> ('a -> 'b) -> ('b, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Infix version of <a href="CCVector.html#VALmap"><code class="code"><span class="constructor">CCVector</span>.map</code></a><br>
|
|
</div>
|
|
|
|
<pre><span id="VALget"><span class="keyword">val</span> get</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> int -> 'a</code></pre><div class="info ">
|
|
Access element by its index, or<br>
|
|
<b>Raises</b> <code>Invalid_argument</code> if bad index<br>
|
|
</div>
|
|
|
|
<pre><span id="VALset"><span class="keyword">val</span> set</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> int -> 'a -> unit</code></pre><div class="info ">
|
|
Modify element at given index, or<br>
|
|
<b>Raises</b> <code>Invalid_argument</code> if bad index<br>
|
|
</div>
|
|
|
|
<pre><span id="VALremove"><span class="keyword">val</span> remove</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info ">
|
|
Remove the <code class="code">n-th</code> element of the vector. Does <b>NOT</b> preserve the order
|
|
of the elements (might swap with the last element)<br>
|
|
</div>
|
|
|
|
<pre><span id="VALrev"><span class="keyword">val</span> rev</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> ('a, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Reverse the vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALrev_in_place"><span class="keyword">val</span> rev_in_place</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
Reverse the vector in place<br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
|
|
<pre><span id="VALrev_iter"><span class="keyword">val</span> rev_iter</span> : <code class="type">('a -> unit) -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
|
|
<code class="code">rev_iter f a</code> is the same as <code class="code">iter f (rev a)</code>, only more efficient.<br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
|
|
<pre><span id="VALsize"><span class="keyword">val</span> size</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> int</code></pre><div class="info ">
|
|
Number of elements in vector<br>
|
|
</div>
|
|
|
|
<pre><span id="VALlength"><span class="keyword">val</span> length</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> int</code></pre><div class="info ">
|
|
Synonym for <a href="CCVector.html#VALsize"><code class="code"><span class="constructor">CCVector</span>.size</code></a><br>
|
|
</div>
|
|
|
|
<pre><span id="VALcapacity"><span class="keyword">val</span> capacity</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> int</code></pre><div class="info ">
|
|
Number of elements the vector can contain without being resized<br>
|
|
</div>
|
|
|
|
<pre><span id="VALunsafe_get_array"><span class="keyword">val</span> unsafe_get_array</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a array</code></pre><div class="info ">
|
|
Access the underlying <b>shared</b> array (do not modify!).
|
|
<code class="code">unsafe_get_array v</code> is longer than <code class="code">size v</code>, but elements at higher
|
|
index than <code class="code">size v</code> are undefined (do not access!).<br>
|
|
</div>
|
|
|
|
<pre><span id="VAL(--)"><span class="keyword">val</span> (--)</span> : <code class="type">int -> int -> (int, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Range of integers, either ascending or descending (both included,
|
|
therefore the result is never empty).
|
|
Example: <code class="code">1 -- 10</code> returns the vector <code class="code">[1;2;3;4;5;6;7;8;9;10]</code><br>
|
|
</div>
|
|
|
|
<pre><span id="VAL(--^)"><span class="keyword">val</span> (--^)</span> : <code class="type">int -> int -> (int, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre><div class="info ">
|
|
Range of integers, either ascending or descending, but excluding right.,
|
|
Example: <code class="code">1 --^ 10</code> returns the vector <code class="code">[1;2;3;4;5;6;7;8;9]</code><br>
|
|
<b>Since</b> 0.17<br>
|
|
</div>
|
|
|
|
<pre><span id="VALof_array"><span class="keyword">val</span> of_array</span> : <code class="type">'a array -> ('a, 'mut) <a href="CCVector.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, 'mut) <a href="CCVector.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALto_array"><span class="keyword">val</span> to_array</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a array</code></pre>
|
|
<pre><span id="VALto_list"><span class="keyword">val</span> to_list</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a list</code></pre>
|
|
<pre><span id="VALof_seq"><span class="keyword">val</span> of_seq</span> : <code class="type">?init:('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -><br> 'a <a href="CCVector.html#TYPEsequence">sequence</a> -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALto_seq"><span class="keyword">val</span> to_seq</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a <a href="CCVector.html#TYPEsequence">sequence</a></code></pre>
|
|
<pre><span id="VALto_seq_rev"><span class="keyword">val</span> to_seq_rev</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a <a href="CCVector.html#TYPEsequence">sequence</a></code></pre><div class="info ">
|
|
<code class="code">to_seq_rev v</code> returns the sequence of elements of <code class="code">v</code> in reverse order,
|
|
that is, the last elements of <code class="code">v</code> are iterated on first.<br>
|
|
<b>Since</b> 0.14<br>
|
|
</div>
|
|
|
|
<pre><span id="VALslice"><span class="keyword">val</span> slice</span> : <code class="type">('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -> 'a array * int * int</code></pre><div class="info ">
|
|
Vector as an array slice. By doing it we expose the internal array, so
|
|
be careful!<br>
|
|
</div>
|
|
|
|
<pre><span id="VALslice_seq"><span class="keyword">val</span> slice_seq</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> int -> int -> 'a <a href="CCVector.html#TYPEsequence">sequence</a></code></pre><div class="info ">
|
|
<code class="code">slice_seq v start len</code> is the sequence of elements from <code class="code">v.(start)</code>
|
|
to <code class="code">v.(start+len-1)</code>.<br>
|
|
</div>
|
|
|
|
<pre><span id="VALof_klist"><span class="keyword">val</span> of_klist</span> : <code class="type">?init:('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -><br> 'a <a href="CCVector.html#TYPEklist">klist</a> -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALto_klist"><span class="keyword">val</span> to_klist</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a <a href="CCVector.html#TYPEklist">klist</a></code></pre>
|
|
<pre><span id="VALof_gen"><span class="keyword">val</span> of_gen</span> : <code class="type">?init:('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a> -><br> 'a <a href="CCVector.html#TYPEgen">gen</a> -> ('a, <a href="CCVector.html#TYPErw">rw</a>) <a href="CCVector.html#TYPEt">t</a></code></pre>
|
|
<pre><span id="VALto_gen"><span class="keyword">val</span> to_gen</span> : <code class="type">('a, 'b) <a href="CCVector.html#TYPEt">t</a> -> 'a <a href="CCVector.html#TYPEgen">gen</a></code></pre>
|
|
<pre><span id="VALpp"><span class="keyword">val</span> pp</span> : <code class="type">?start:string -><br> ?stop:string -><br> ?sep:string -> 'a <a href="CCVector.html#TYPEprinter">printer</a> -> ('a, 'b) <a href="CCVector.html#TYPEt">t</a> <a href="CCVector.html#TYPEprinter">printer</a></code></pre></body></html> |