ocaml-containers/2.4/containers/CCInt/index.html
2018-12-23 21:02:45 -06:00

2 lines
No EOL
17 KiB
HTML
Raw Permalink 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>CCInt (containers.CCInt)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><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</a> &#x00BB; CCInt</nav><h1>Module <code>CCInt</code></h1><h2 id="basic-int-functions"><a href="#basic-int-functions" class="anchor"></a>Basic Int functions</h2><nav class="toc"><ul><li><a href="#infix-operators">Infix Operators</a></li></ul></nav></header><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type </span>t</code><code><span class="keyword"> = </span>int</code></dt></dl><dl><dt class="spec value" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span class="keyword">val </span>compare : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int</code></dt><dd><p>The comparison function for integers with the same specification as <span class="xref-unresolved" title="unresolved reference to &quot;Pervasives.compare&quot;"><code>Pervasives</code>.compare</span>.</p></dd></dl><dl><dt class="spec value" id="val-equal"><a href="#val-equal" class="anchor"></a><code><span class="keyword">val </span>equal : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>Equality function for integers.</p></dd></dl><dl><dt class="spec value" id="val-hash"><a href="#val-hash" class="anchor"></a><code><span class="keyword">val </span>hash : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int</code></dt><dt class="spec value" id="val-sign"><a href="#val-sign" class="anchor"></a><code><span class="keyword">val </span>sign : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int</code></dt><dd><p><code>sign i</code> is one of <code>-1, 0, 1</code>.</p></dd></dl><dl><dt class="spec value" id="val-neg"><a href="#val-neg" class="anchor"></a><code><span class="keyword">val </span>neg : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>Unary negation. <code>neg i = - i</code>.</p><dl><dt>since</dt><dd>0.5</dd></dl></dd></dl><dl><dt class="spec value" id="val-pow"><a href="#val-pow" class="anchor"></a><code><span class="keyword">val </span>pow : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>pow base exponent</code> returns <code>base</code> raised to the power of <code>exponent</code>. <code>pow a b = a^b</code> for positive integers <code>a</code> and <code>b</code>. Raises <code>Invalid_argument</code> if <code>a = b = 0</code> or <code>b</code> &lt; 0.</p><dl><dt>since</dt><dd>0.11</dd></dl></dd></dl><dl><dt class="spec value" id="val-floor_div"><a href="#val-floor_div" class="anchor"></a><code><span class="keyword">val </span>floor_div : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>floor_div a n</code> is integer division rounding towards negative infinity. It satisfies <code>a = m * floor_div a n + rem a n</code>.</p><dl><dt>since</dt><dd>1.2</dd></dl></dd></dl><dl><dt class="spec value" id="val-rem"><a href="#val-rem" class="anchor"></a><code><span class="keyword">val </span>rem : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>rem a n</code> is the remainder of dividing <code>a</code> by <code>n</code>, with the same sign as <code>n</code>.</p><dl><dt>since</dt><dd>1.2</dd></dl></dd></dl><dl><dt class="spec type" id="type-printer"><a href="#type-printer" class="anchor"></a><code><span class="keyword">type </span>'a printer</code><code><span class="keyword"> = </span>Format.formatter <span>&#45;&gt;</span> <span class="type-var">'a</span> <span>&#45;&gt;</span> unit</code></dt><dt class="spec type" id="type-random_gen"><a href="#type-random_gen" class="anchor"></a><code><span class="keyword">type </span>'a random_gen</code><code><span class="keyword"> = </span>Random.State.t <span>&#45;&gt;</span> <span class="type-var">'a</span></code></dt><dt class="spec type" id="type-sequence"><a href="#type-sequence" class="anchor"></a><code><span class="keyword">type </span>'a sequence</code><code><span class="keyword"> = </span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> unit) <span>&#45;&gt;</span> unit</code></dt></dl><dl><dt class="spec value" id="val-random"><a href="#val-random" class="anchor"></a><code><span class="keyword">val </span>random : int <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <a href="index.html#type-random_gen">random_gen</a></code></dt><dt class="spec value" id="val-random_small"><a href="#val-random_small" class="anchor"></a><code><span class="keyword">val </span>random_small : <a href="index.html#type-t">t</a> <a href="index.html#type-random_gen">random_gen</a></code></dt><dt class="spec value" id="val-random_range"><a href="#val-random_range" class="anchor"></a><code><span class="keyword">val </span>random_range : int <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <a href="index.html#type-random_gen">random_gen</a></code></dt><dt class="spec value" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span class="keyword">val </span>pp : <a href="index.html#type-t">t</a> <a href="index.html#type-printer">printer</a></code></dt><dt class="spec value" id="val-to_string"><a href="#val-to_string" class="anchor"></a><code><span class="keyword">val </span>to_string : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> string</code></dt><dd><p>Return the string representation of its argument, in signed decimal.</p><dl><dt>since</dt><dd>0.13</dd></dl></dd></dl><dl><dt class="spec value" id="val-of_string"><a href="#val-of_string" class="anchor"></a><code><span class="keyword">val </span>of_string : string <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> option</code></dt><dd><dl><dt>since</dt><dd>0.13</dd></dl></dd></dl><dl><dt class="spec value" id="val-pp_binary"><a href="#val-pp_binary" class="anchor"></a><code><span class="keyword">val </span>pp_binary : <a href="index.html#type-t">t</a> <a href="index.html#type-printer">printer</a></code></dt><dd><p>Print as &quot;0b00101010&quot;.</p><dl><dt>since</dt><dd>0.20</dd></dl></dd></dl><dl><dt class="spec value" id="val-to_string_binary"><a href="#val-to_string_binary" class="anchor"></a><code><span class="keyword">val </span>to_string_binary : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> string</code></dt><dd><dl><dt>since</dt><dd>0.20</dd></dl></dd></dl><dl><dt class="spec value" id="val-min"><a href="#val-min" class="anchor"></a><code><span class="keyword">val </span>min : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>The minimum of two integers.</p><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-max"><a href="#val-max" class="anchor"></a><code><span class="keyword">val </span>max : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>The maximum of two integers.</p><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-range_by"><a href="#val-range_by" class="anchor"></a><code><span class="keyword">val </span>range_by : step:<a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <a href="index.html#type-sequence">sequence</a></code></dt><dd><p><code>range_by ~step i j</code> iterates on integers from <code>i</code> to <code>j</code> included, where the difference between successive elements is <code>step</code>. Use a negative <code>step</code> for a decreasing list.</p><dl><dt>raises Invalid_argument</dt><dd><p>if <code>step=0</code>.</p></dd></dl><dl><dt>since</dt><dd>1.2</dd></dl></dd></dl><dl><dt class="spec value" id="val-range"><a href="#val-range" class="anchor"></a><code><span class="keyword">val </span>range : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <a href="index.html#type-sequence">sequence</a></code></dt><dd><p><code>range i j</code> iterates on integers from <code>i</code> to <code>j</code> included . It works both for decreasing and increasing ranges.</p><dl><dt>since</dt><dd>1.2</dd></dl></dd></dl><dl><dt class="spec value" id="val-range'"><a href="#val-range'" class="anchor"></a><code><span class="keyword">val </span>range' : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <a href="index.html#type-sequence">sequence</a></code></dt><dd><p>Like <a href="index.html#val-range"><code>range</code></a> but the second bound is excluded. For instance <code>range' 0 5 = Sequence.of_list [0;1;2;3;4]</code>.</p><dl><dt>since</dt><dd>1.2</dd></dl></dd></dl><section><header><h2 id="infix-operators"><a href="#infix-operators" class="anchor"></a>Infix Operators</h2><dl><dt>since</dt><dd>0.17</dd></dl></header><div class="spec module" id="module-Infix"><a href="#module-Infix" class="anchor"></a><code><span class="keyword">module </span><a href="Infix/index.html">Infix</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></div><div><div class="spec include"><div class="doc"><details open="open"><summary><span class="def"><code><span class="keyword">include </span><span class="keyword">module type of </span><a href="index.html#module-Infix">Infix</a></code></span></summary><dl><dt class="spec value" id="val-(=)"><a href="#val-(=)" class="anchor"></a><code><span class="keyword">val </span>(=) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-(&lt;&gt;)"><a href="#val-(&lt;&gt;)" class="anchor"></a><code><span class="keyword">val </span>(&lt;&gt;) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-(&lt;)"><a href="#val-(&lt;)" class="anchor"></a><code><span class="keyword">val </span>(&lt;) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-(&gt;)"><a href="#val-(&gt;)" class="anchor"></a><code><span class="keyword">val </span>(&gt;) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-(&lt;=)"><a href="#val-(&lt;=)" class="anchor"></a><code><span class="keyword">val </span>(&lt;=) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-(&gt;=)"><a href="#val-(&gt;=)" class="anchor"></a><code><span class="keyword">val </span>(&gt;=) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> bool</code></dt><dd><dl><dt>since</dt><dd>0.17</dd></dl></dd></dl><dl><dt class="spec value" id="val-(--)"><a href="#val-(--)" class="anchor"></a><code><span class="keyword">val </span>(--) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <a href="index.html#type-sequence">sequence</a></code></dt><dd><p>Alias to <a href="index.html#val-range"><code>range</code></a>.</p><dl><dt>since</dt><dd>1.2</dd></dl></dd></dl><dl><dt class="spec value" id="val-(--^)"><a href="#val-(--^)" class="anchor"></a><code><span class="keyword">val </span>(--^) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <a href="index.html#type-sequence">sequence</a></code></dt><dd><p>Alias to <a href="index.html#val-range'"><code>range'</code></a>.</p><dl><dt>since</dt><dd>1.2</dd></dl></dd></dl><dl><dt class="spec value" id="val-(+)"><a href="#val-(+)" class="anchor"></a><code><span class="keyword">val </span>(+) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(-)"><a href="#val-(-)" class="anchor"></a><code><span class="keyword">val </span>(-) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(~-)"><a href="#val-(~-)" class="anchor"></a><code><span class="keyword">val </span>(~-) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(*)"><a href="#val-(*)" class="anchor"></a><code><span class="keyword">val </span>(*) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(/)"><a href="#val-(/)" class="anchor"></a><code><span class="keyword">val </span>(/) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(**)"><a href="#val-(**)" class="anchor"></a><code><span class="keyword">val </span>(**) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.4</dd></dl></dd></dl><dl><dt class="spec value" id="val-(mod)"><a href="#val-(mod)" class="anchor"></a><code><span class="keyword">val </span>(mod) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(land)"><a href="#val-(land)" class="anchor"></a><code><span class="keyword">val </span>(land) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(lor)"><a href="#val-(lor)" class="anchor"></a><code><span class="keyword">val </span>(lor) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(lxor)"><a href="#val-(lxor)" class="anchor"></a><code><span class="keyword">val </span>(lxor) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(lnot)"><a href="#val-(lnot)" class="anchor"></a><code><span class="keyword">val </span>(lnot) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(lsl)"><a href="#val-(lsl)" class="anchor"></a><code><span class="keyword">val </span>(lsl) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(lsr)"><a href="#val-(lsr)" class="anchor"></a><code><span class="keyword">val </span>(lsr) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl><dl><dt class="spec value" id="val-(asr)"><a href="#val-(asr)" class="anchor"></a><code><span class="keyword">val </span>(asr) : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><dl><dt>since</dt><dd>2.1</dd></dl></dd></dl></details></div></div></div></section></div></body></html>