ocaml-containers/dev/containers-data/CCWBTree/Make/index.html
2021-08-02 17:37:24 +00:00

2 lines
No EOL
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Make (containers-data.CCWBTree.Make)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">containers-data</a> &#x00BB; <a href="../index.html">CCWBTree</a> &#x00BB; Make</nav><h1>Module <code>CCWBTree.Make</code></h1></header><h3 class="heading">Parameters</h3><ul><li><code><a href="argument-1-X/index.html">X</a> : <a href="../index.html#module-type-ORD">ORD</a></code></li></ul><h3 class="heading">Signature</h3><dl><dt class="spec type" id="type-key"><a href="#type-key" class="anchor"></a><code><span class="keyword">type</span> key</code><code> = <a href="argument-1-X/index.html#type-t">X.t</a></code></dt><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> <span>+'a t</span></code></dt></dl><dl><dt class="spec value" id="val-empty"><a href="#val-empty" class="anchor"></a><code><span class="keyword">val</span> empty : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-is_empty"><a href="#val-is_empty" class="anchor"></a><code><span class="keyword">val</span> is_empty : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> bool</code></dt><dt class="spec value" id="val-singleton"><a href="#val-singleton" class="anchor"></a><code><span class="keyword">val</span> singleton : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span class="type-var">'a</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-mem"><a href="#val-mem" class="anchor"></a><code><span class="keyword">val</span> mem : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> bool</code></dt><dt class="spec value" id="val-get"><a href="#val-get" class="anchor"></a><code><span class="keyword">val</span> get : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span></code></dt><dt class="spec value" id="val-get_exn"><a href="#val-get_exn" class="anchor"></a><code><span class="keyword">val</span> get_exn : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span class="type-var">'a</span></code></dt><dd><dl><dt>raises Not_found</dt><dd><p>if the key is not present.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-nth"><a href="#val-nth" class="anchor"></a><code><span class="keyword">val</span> nth : int <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> option</span></code></dt><dd><p><code>nth i m</code> returns the <code>i</code>-th <code>key, value</code> in the ascending order. Complexity is <code>O(log (cardinal m))</code>.</p></dd></dl><dl><dt class="spec value" id="val-nth_exn"><a href="#val-nth_exn" class="anchor"></a><code><span class="keyword">val</span> nth_exn : int <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <a href="index.html#type-key">key</a> * <span class="type-var">'a</span></code></dt><dd><dl><dt>raises Not_found</dt><dd><p>if the index is invalid.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-get_rank"><a href="#val-get_rank" class="anchor"></a><code><span class="keyword">val</span> get_rank : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span>[ <span>`At of int</span> <span><span>| `After</span> of int</span> <span>| `First</span> ]</span></code></dt><dd><p><code>get_rank k m</code> looks for the rank of <code>k</code> in <code>m</code>, i.e. the index of <code>k</code> in the sorted list of bindings of <code>m</code>. <code>let (`At n) = get_rank k m in nth_exn n m = get m k</code> should hold.</p><dl><dt>since</dt><dd>1.4</dd></dl></dd></dl><dl><dt class="spec value" id="val-add"><a href="#val-add" class="anchor"></a><code><span class="keyword">val</span> add : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span class="type-var">'a</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-remove"><a href="#val-remove" class="anchor"></a><code><span class="keyword">val</span> remove : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-update"><a href="#val-update" class="anchor"></a><code><span class="keyword">val</span> update : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span>(<span><span class="type-var">'a</span> option</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span>)</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p><code>update k f m</code> calls <code>f (Some v)</code> if <code>get k m = Some v</code>, <code>f None</code> otherwise. Then, if <code>f</code> returns <code>Some v'</code> it binds <code>k</code> to <code>v'</code>, if <code>f</code> returns <code>None</code> it removes <code>k</code>.</p></dd></dl><dl><dt class="spec value" id="val-cardinal"><a href="#val-cardinal" class="anchor"></a><code><span class="keyword">val</span> cardinal : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> int</code></dt><dt class="spec value" id="val-weight"><a href="#val-weight" class="anchor"></a><code><span class="keyword">val</span> weight : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> int</code></dt><dt class="spec value" id="val-fold"><a href="#val-fold" class="anchor"></a><code><span class="keyword">val</span> fold : <span>f:<span>(<span class="type-var">'b</span> <span>&#45;&gt;</span> <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'b</span>)</span></span> <span>&#45;&gt;</span> <span>x:<span class="type-var">'b</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span class="type-var">'b</span></code></dt><dt class="spec value" id="val-mapi"><a href="#val-mapi" class="anchor"></a><code><span class="keyword">val</span> mapi : <span>f:<span>(<a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'b</span>)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p>Map values, giving both key and value. Will use <span class="xref-unresolved" title="unresolved reference to &quot;WORD.of_list&quot;"><code>WORD</code>.of_list</span> to rebuild keys.</p><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-map"><a href="#val-map" class="anchor"></a><code><span class="keyword">val</span> map : <span>f:<span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'b</span>)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p>Map values, giving only the value.</p><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-iter"><a href="#val-iter" class="anchor"></a><code><span class="keyword">val</span> iter : <span>f:<span>(<a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span class="type-var">'a</span> <span>&#45;&gt;</span> unit)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> unit</code></dt><dt class="spec value" id="val-split"><a href="#val-split" class="anchor"></a><code><span class="keyword">val</span> split : <a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> * <span><span class="type-var">'a</span> option</span> * <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p><code>split k t</code> returns <code>l, o, r</code> where <code>l</code> is the part of the map with keys smaller than <code>k</code>, <code>r</code> has keys bigger than <code>k</code>, and <code>o = Some v</code> if <code>k, v</code> belonged to the map.</p></dd></dl><dl><dt class="spec value" id="val-merge"><a href="#val-merge" class="anchor"></a><code><span class="keyword">val</span> merge : <span>f:<span>(<a href="index.html#type-key">key</a> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> option</span> <span>&#45;&gt;</span> <span><span class="type-var">'c</span> option</span>)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'c</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p>Like <span class="xref-unresolved" title="unresolved reference to &quot;Map.S.merge&quot;"><span class="xref-unresolved" title="unresolved reference to &quot;Map.S&quot;"><code>Map</code>.S</span>.merge</span>.</p></dd></dl><dl><dt class="spec value" id="val-extract_min"><a href="#val-extract_min" class="anchor"></a><code><span class="keyword">val</span> extract_min : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <a href="index.html#type-key">key</a> * <span class="type-var">'a</span> * <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p><code>extract_min m</code> returns <code>k, v, m'</code> where <code>k,v</code> is the pair with the smallest key in <code>m</code>, and <code>m'</code> does not contain <code>k</code>.</p><dl><dt>raises Not_found</dt><dd><p>if the map is empty.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-extract_max"><a href="#val-extract_max" class="anchor"></a><code><span class="keyword">val</span> extract_max : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <a href="index.html#type-key">key</a> * <span class="type-var">'a</span> * <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p><code>extract_max m</code> returns <code>k, v, m'</code> where <code>k,v</code> is the pair with the highest key in <code>m</code>, and <code>m'</code> does not contain <code>k</code>.</p><dl><dt>raises Not_found</dt><dd><p>if the map is empty.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-choose"><a href="#val-choose" class="anchor"></a><code><span class="keyword">val</span> choose : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> option</span></code></dt><dt class="spec value" id="val-choose_exn"><a href="#val-choose_exn" class="anchor"></a><code><span class="keyword">val</span> choose_exn : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <a href="index.html#type-key">key</a> * <span class="type-var">'a</span></code></dt><dd><dl><dt>raises Not_found</dt><dd><p>if the tree is empty.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-random_choose"><a href="#val-random_choose" class="anchor"></a><code><span class="keyword">val</span> random_choose : Stdlib.Random.State.t <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <a href="index.html#type-key">key</a> * <span class="type-var">'a</span></code></dt><dd><p>Randomly choose a (key,value) pair within the tree, using weights as probability weights.</p><dl><dt>raises Not_found</dt><dd><p>if the tree is empty.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-add_list"><a href="#val-add_list" class="anchor"></a><code><span class="keyword">val</span> add_list : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> list</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-of_list"><a href="#val-of_list" class="anchor"></a><code><span class="keyword">val</span> of_list : <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> list</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-to_list"><a href="#val-to_list" class="anchor"></a><code><span class="keyword">val</span> to_list : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> list</span></code></dt><dt class="spec value" id="val-add_iter"><a href="#val-add_iter" class="anchor"></a><code><span class="keyword">val</span> add_iter : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> <a href="../index.html#type-iter">iter</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-of_iter"><a href="#val-of_iter" class="anchor"></a><code><span class="keyword">val</span> of_iter : <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> <a href="../index.html#type-iter">iter</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-to_iter"><a href="#val-to_iter" class="anchor"></a><code><span class="keyword">val</span> to_iter : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> <a href="../index.html#type-iter">iter</a></span></code></dt><dt class="spec value" id="val-add_gen"><a href="#val-add_gen" class="anchor"></a><code><span class="keyword">val</span> add_gen : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> <a href="../index.html#type-gen">gen</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-of_gen"><a href="#val-of_gen" class="anchor"></a><code><span class="keyword">val</span> of_gen : <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> <a href="../index.html#type-gen">gen</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-to_gen"><a href="#val-to_gen" class="anchor"></a><code><span class="keyword">val</span> to_gen : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<a href="index.html#type-key">key</a> * <span class="type-var">'a</span>)</span> <a href="../index.html#type-gen">gen</a></span></code></dt><dt class="spec value" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span class="keyword">val</span> pp : <span>?&#8288;pp_start:<span>unit <a href="../index.html#type-printer">printer</a></span></span> <span>&#45;&gt;</span> <span>?&#8288;pp_stop:<span>unit <a href="../index.html#type-printer">printer</a></span></span> <span>&#45;&gt;</span> <span>?&#8288;pp_arrow:<span>unit <a href="../index.html#type-printer">printer</a></span></span> <span>&#45;&gt;</span> <span>?&#8288;pp_sep:<span>unit <a href="../index.html#type-printer">printer</a></span></span> <span>&#45;&gt;</span> <span><a href="index.html#type-key">key</a> <a href="../index.html#type-printer">printer</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-printer">printer</a></span> <span>&#45;&gt;</span> <span><span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <a href="../index.html#type-printer">printer</a></span></code></dt><dd><p>Renamed from <code>val print</code>.</p><dl><dt>since</dt><dd>2.0</dd></dl></dd></dl></div></body></html>