moonpool/dev/ocaml/Stdlib/index.html
2023-08-29 18:39:53 +00:00

8 lines
No EOL
147 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>Stdlib (ocaml.Stdlib)</title><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../index.html">ocaml</a> &#x00BB; Stdlib</nav><header class="odoc-preamble"><h1>Module <code><span>Stdlib</span></code></h1><p>The OCaml Standard library.</p><p>This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by <code>Stdlib</code>.</p><p>In particular, it provides the basic operations over the built-in types (numbers, booleans, byte sequences, strings, exceptions, references, lists, arrays, input-output channels, ...) and the <a href="#modules">standard library modules</a>.</p></header><nav class="odoc-toc"><ul><li><a href="#exceptions">Exceptions</a></li><li><a href="#comparisons">Comparisons</a></li><li><a href="#boolean-operations">Boolean operations</a></li><li><a href="#debugging">Debugging</a></li><li><a href="#composition-operators">Composition operators</a></li><li><a href="#integer-arithmetic">Integer arithmetic</a><ul><li><a href="#bitwise-operations">Bitwise operations</a></li></ul></li><li><a href="#floating-point-arithmetic">Floating-point arithmetic</a></li><li><a href="#string-operations">String operations</a></li><li><a href="#character-operations">Character operations</a></li><li><a href="#unit-operations">Unit operations</a></li><li><a href="#string-conversion-functions">String conversion functions</a></li><li><a href="#pair-operations">Pair operations</a></li><li><a href="#list-operations">List operations</a></li><li><a href="#input/output">Input/output</a><ul><li><a href="#output-functions-on-standard-output">Output functions on standard output</a></li><li><a href="#output-functions-on-standard-error">Output functions on standard error</a></li><li><a href="#input-functions-on-standard-input">Input functions on standard input</a></li><li><a href="#general-output-functions">General output functions</a></li><li><a href="#general-input-functions">General input functions</a></li><li><a href="#operations-on-large-files">Operations on large files</a></li></ul></li><li><a href="#references">References</a></li><li><a href="#result-type">Result type</a></li><li><a href="#operations-on-format-strings">Operations on format strings</a></li><li><a href="#program-termination">Program termination</a></li><li><a href="#modules">Standard library modules</a></li></ul></nav><div class="odoc-content"><h2 id="exceptions"><a href="#exceptions" class="anchor"></a>Exceptions</h2><div class="odoc-spec"><div class="spec value external anchored" id="val-raise"><a href="#val-raise" class="anchor"></a><code><span><span class="keyword">val</span> raise : <span>exn <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Raise the given exception value</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-raise_notrace"><a href="#val-raise_notrace" class="anchor"></a><code><span><span class="keyword">val</span> raise_notrace : <span>exn <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>A faster version <code>raise</code> which does not record the backtrace.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-invalid_arg"><a href="#val-invalid_arg" class="anchor"></a><code><span><span class="keyword">val</span> invalid_arg : <span>string <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Raise exception <code>Invalid_argument</code> with the given string.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-failwith"><a href="#val-failwith" class="anchor"></a><code><span><span class="keyword">val</span> failwith : <span>string <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Raise exception <code>Failure</code> with the given string.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Exit"><a href="#exception-Exit" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Exit</span></span></code></div><div class="spec-doc"><p>The <code>Exit</code> exception is not raised by any library function. It is provided for use in your programs.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Match_failure"><a href="#exception-Match_failure" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Match_failure</span> <span class="keyword">of</span> string * int * int</span></code></div><div class="spec-doc"><p>Exception raised when none of the cases of a pattern-matching apply. The arguments are the location of the match keyword in the source code (file name, line number, column number).</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Assert_failure"><a href="#exception-Assert_failure" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Assert_failure</span> <span class="keyword">of</span> string * int * int</span></code></div><div class="spec-doc"><p>Exception raised when an assertion fails. The arguments are the location of the assert keyword in the source code (file name, line number, column number).</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Invalid_argument"><a href="#exception-Invalid_argument" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Invalid_argument</span> <span class="keyword">of</span> string</span></code></div><div class="spec-doc"><p>Exception raised by library functions to signal that the given arguments do not make sense. The string gives some information to the programmer. As a general rule, this exception should not be caught, it denotes a programming error and the code should be modified not to trigger it.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Failure"><a href="#exception-Failure" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Failure</span> <span class="keyword">of</span> string</span></code></div><div class="spec-doc"><p>Exception raised by library functions to signal that they are undefined on the given arguments. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Failure _ instead).</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Not_found"><a href="#exception-Not_found" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Not_found</span></span></code></div><div class="spec-doc"><p>Exception raised by search functions when the desired object could not be found.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Out_of_memory"><a href="#exception-Out_of_memory" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Out_of_memory</span></span></code></div><div class="spec-doc"><p>Exception raised by the garbage collector when there is insufficient memory to complete the computation. (Not reliable for allocations on the minor heap.)</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Stack_overflow"><a href="#exception-Stack_overflow" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Stack_overflow</span></span></code></div><div class="spec-doc"><p>Exception raised by the bytecode interpreter when the evaluation stack reaches its maximal size. This often indicates infinite or excessively deep recursion in the user's program.</p><p>Before 4.10, it was not fully implemented by the native-code compiler.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Sys_error"><a href="#exception-Sys_error" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Sys_error</span> <span class="keyword">of</span> string</span></code></div><div class="spec-doc"><p>Exception raised by the input/output functions to report an operating system error. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Sys_error _ instead).</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-End_of_file"><a href="#exception-End_of_file" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">End_of_file</span></span></code></div><div class="spec-doc"><p>Exception raised by input functions to signal that the end of file has been reached.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Division_by_zero"><a href="#exception-Division_by_zero" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Division_by_zero</span></span></code></div><div class="spec-doc"><p>Exception raised by integer division and remainder operations when their second argument is zero.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Sys_blocked_io"><a href="#exception-Sys_blocked_io" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Sys_blocked_io</span></span></code></div><div class="spec-doc"><p>A special case of Sys_error raised when no I/O is possible on a non-blocking I/O channel.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Undefined_recursive_module"><a href="#exception-Undefined_recursive_module" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Undefined_recursive_module</span> <span class="keyword">of</span> string * int * int</span></code></div><div class="spec-doc"><p>Exception raised when an ill-founded recursive module definition is evaluated. The arguments are the location of the definition in the source code (file name, line number, column number).</p></div></div><h2 id="comparisons"><a href="#comparisons" class="anchor"></a>Comparisons</h2><div class="odoc-spec"><div class="spec value external anchored" id="val-(=)"><a href="#val-(=)" class="anchor"></a><code><span><span class="keyword">val</span> (=) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>e1 = e2</code> tests for structural equality of <code>e1</code> and <code>e2</code>. Mutable structures (e.g. references and arrays) are equal if and only if their current contents are structurally equal, even if the two mutable objects are not the same physical object. Equality between functional values raises <code>Invalid_argument</code>. Equality between cyclic data structures may not terminate. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(&lt;&gt;)"><a href="#val-(&lt;&gt;)" class="anchor"></a><code><span><span class="keyword">val</span> (&lt;&gt;) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>Negation of <a href="#val-(=)"><code>Stdlib.(=)</code></a>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(&lt;)"><a href="#val-(&lt;)" class="anchor"></a><code><span><span class="keyword">val</span> (&lt;) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>See <a href="#val-(&gt;=)"><code>Stdlib.(&gt;=)</code></a>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(&gt;)"><a href="#val-(&gt;)" class="anchor"></a><code><span><span class="keyword">val</span> (&gt;) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>See <a href="#val-(&gt;=)"><code>Stdlib.(&gt;=)</code></a>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(&lt;=)"><a href="#val-(&lt;=)" class="anchor"></a><code><span><span class="keyword">val</span> (&lt;=) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>See <a href="#val-(&gt;=)"><code>Stdlib.(&gt;=)</code></a>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(&gt;=)"><a href="#val-(&gt;=)" class="anchor"></a><code><span><span class="keyword">val</span> (&gt;=) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>Structural ordering functions. These functions coincide with the usual orderings over integers, characters, strings, byte sequences and floating-point numbers, and extend them to a total ordering over all types. The ordering is compatible with <code>( = )</code>. As in the case of <code>( = )</code>, mutable structures are compared by contents. Comparison between functional values raises <code>Invalid_argument</code>. Comparison between cyclic structures may not terminate. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span><span class="keyword">val</span> compare : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>compare x y</code> returns <code>0</code> if <code>x</code> is equal to <code>y</code>, a negative integer if <code>x</code> is less than <code>y</code>, and a positive integer if <code>x</code> is greater than <code>y</code>. The ordering implemented by <code>compare</code> is compatible with the comparison predicates <code>=</code>, <code>&lt;</code> and <code>&gt;</code> defined above, with one difference on the treatment of the float value <a href="#val-nan"><code>Stdlib.nan</code></a>. Namely, the comparison predicates treat <code>nan</code> as different from any other float value, including itself; while <code>compare</code> treats <code>nan</code> as equal to itself and less than any other float value. This treatment of <code>nan</code> ensures that <code>compare</code> defines a total ordering relation.</p><p><code>compare</code> applied to functional values may raise <code>Invalid_argument</code>. <code>compare</code> applied to cyclic structures may not terminate.</p><p>The <code>compare</code> function can be used as the comparison function required by the <a href="Set/Make/index.html"><code>Set.Make</code></a> and <a href="Map/Make/index.html"><code>Map.Make</code></a> functors, as well as the <a href="List/index.html#val-sort"><code>List.sort</code></a> and <a href="Array/index.html#val-sort"><code>Array.sort</code></a> functions.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-min"><a href="#val-min" class="anchor"></a><code><span><span class="keyword">val</span> min : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Return the smaller of the two arguments. The result is unspecified if one of the arguments contains the float value <code>nan</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-max"><a href="#val-max" class="anchor"></a><code><span><span class="keyword">val</span> max : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Return the greater of the two arguments. The result is unspecified if one of the arguments contains the float value <code>nan</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(==)"><a href="#val-(==)" class="anchor"></a><code><span><span class="keyword">val</span> (==) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>e1 == e2</code> tests for physical equality of <code>e1</code> and <code>e2</code>. On mutable types such as references, arrays, byte sequences, records with mutable fields and objects with mutable instance variables, <code>e1 == e2</code> is true if and only if physical modification of <code>e1</code> also affects <code>e2</code>. On non-mutable types, the behavior of <code>( == )</code> is implementation-dependent; however, it is guaranteed that <code>e1 == e2</code> implies <code>compare e1 e2 = 0</code>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(!=)"><a href="#val-(!=)" class="anchor"></a><code><span><span class="keyword">val</span> (!=) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>Negation of <a href="#val-(==)"><code>Stdlib.(==)</code></a>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><h2 id="boolean-operations"><a href="#boolean-operations" class="anchor"></a>Boolean operations</h2><div class="odoc-spec"><div class="spec value external anchored" id="val-not"><a href="#val-not" class="anchor"></a><code><span><span class="keyword">val</span> not : <span>bool <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>The boolean negation.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(&amp;&amp;)"><a href="#val-(&amp;&amp;)" class="anchor"></a><code><span><span class="keyword">val</span> (&amp;&amp;) : <span>bool <span class="arrow">&#45;&gt;</span></span> <span>bool <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>The boolean 'and'. Evaluation is sequential, left-to-right: in <code>e1 &amp;&amp; e2</code>, <code>e1</code> is evaluated first, and if it returns <code>false</code>, <code>e2</code> is not evaluated at all. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(||)"><a href="#val-(||)" class="anchor"></a><code><span><span class="keyword">val</span> (||) : <span>bool <span class="arrow">&#45;&gt;</span></span> <span>bool <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>The boolean 'or'. Evaluation is sequential, left-to-right: in <code>e1 || e2</code>, <code>e1</code> is evaluated first, and if it returns <code>true</code>, <code>e2</code> is not evaluated at all. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><h2 id="debugging"><a href="#debugging" class="anchor"></a>Debugging</h2><div class="odoc-spec"><div class="spec value external anchored" id="val-__LOC__"><a href="#val-__LOC__" class="anchor"></a><code><span><span class="keyword">val</span> __LOC__ : string</span></code></div><div class="spec-doc"><p><code>__LOC__</code> returns the location at which this expression appears in the file currently being parsed by the compiler, with the standard error format of OCaml: &quot;File %S, line %d, characters %d-%d&quot;.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-__FILE__"><a href="#val-__FILE__" class="anchor"></a><code><span><span class="keyword">val</span> __FILE__ : string</span></code></div><div class="spec-doc"><p><code>__FILE__</code> returns the name of the file currently being parsed by the compiler.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-__LINE__"><a href="#val-__LINE__" class="anchor"></a><code><span><span class="keyword">val</span> __LINE__ : int</span></code></div><div class="spec-doc"><p><code>__LINE__</code> returns the line number at which this expression appears in the file currently being parsed by the compiler.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-__MODULE__"><a href="#val-__MODULE__" class="anchor"></a><code><span><span class="keyword">val</span> __MODULE__ : string</span></code></div><div class="spec-doc"><p><code>__MODULE__</code> returns the module name of the file being parsed by the compiler.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-__POS__"><a href="#val-__POS__" class="anchor"></a><code><span><span class="keyword">val</span> __POS__ : string * int * int * int</span></code></div><div class="spec-doc"><p><code>__POS__</code> returns a tuple <code>(file,lnum,cnum,enum)</code>, corresponding to the location at which this expression appears in the file currently being parsed by the compiler. <code>file</code> is the current filename, <code>lnum</code> the line number, <code>cnum</code> the character position in the line and <code>enum</code> the last character position in the line.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-__FUNCTION__"><a href="#val-__FUNCTION__" class="anchor"></a><code><span><span class="keyword">val</span> __FUNCTION__ : string</span></code></div><div class="spec-doc"><p><code>__FUNCTION__</code> returns the name of the current function or method, including any enclosing modules or classes.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.12.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-__LOC_OF__"><a href="#val-__LOC_OF__" class="anchor"></a><code><span><span class="keyword">val</span> __LOC_OF__ : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> string * <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>__LOC_OF__ expr</code> returns a pair <code>(loc, expr)</code> where <code>loc</code> is the location of <code>expr</code> in the file currently being parsed by the compiler, with the standard error format of OCaml: &quot;File %S, line %d, characters %d-%d&quot;.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-__LINE_OF__"><a href="#val-__LINE_OF__" class="anchor"></a><code><span><span class="keyword">val</span> __LINE_OF__ : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> int * <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>__LINE_OF__ expr</code> returns a pair <code>(line, expr)</code>, where <code>line</code> is the line number at which the expression <code>expr</code> appears in the file currently being parsed by the compiler.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-__POS_OF__"><a href="#val-__POS_OF__" class="anchor"></a><code><span><span class="keyword">val</span> __POS_OF__ : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span>(string * int * int * int)</span> * <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>__POS_OF__ expr</code> returns a pair <code>(loc,expr)</code>, where <code>loc</code> is a tuple <code>(file,lnum,cnum,enum)</code> corresponding to the location at which the expression <code>expr</code> appears in the file currently being parsed by the compiler. <code>file</code> is the current filename, <code>lnum</code> the line number, <code>cnum</code> the character position in the line and <code>enum</code> the last character position in the line.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><h2 id="composition-operators"><a href="#composition-operators" class="anchor"></a>Composition operators</h2><div class="odoc-spec"><div class="spec value external anchored" id="val-(|&gt;)"><a href="#val-(|&gt;)" class="anchor"></a><code><span><span class="keyword">val</span> (|&gt;) : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p>Reverse-application operator: <code>x |&gt; f |&gt; g</code> is exactly equivalent to <code>g (f (x))</code>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.01</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(@@)"><a href="#val-(@@)" class="anchor"></a><code><span><span class="keyword">val</span> (@@) : <span><span>(<span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p>Application operator: <code>g @@ f @@ x</code> is exactly equivalent to <code>g (f (x))</code>. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.01</li></ul></div></div><h2 id="integer-arithmetic"><a href="#integer-arithmetic" class="anchor"></a>Integer arithmetic</h2><p>Integers are <code>Sys.int_size</code> bits wide. All operations are taken modulo 2<sup><code>Sys.int_size</code></sup>. They do not fail on overflow.</p><div class="odoc-spec"><div class="spec value external anchored" id="val-(~-)"><a href="#val-(~-)" class="anchor"></a><code><span><span class="keyword">val</span> (~-) : <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Unary negation. You can also write <code>- e</code> instead of <code>~- e</code>. Unary operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(~+)"><a href="#val-(~+)" class="anchor"></a><code><span><span class="keyword">val</span> (~+) : <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Unary addition. You can also write <code>+ e</code> instead of <code>~+ e</code>. Unary operator, see <code>Ocaml_operators</code> for more information.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.12.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-succ"><a href="#val-succ" class="anchor"></a><code><span><span class="keyword">val</span> succ : <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>succ x</code> is <code>x + 1</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-pred"><a href="#val-pred" class="anchor"></a><code><span><span class="keyword">val</span> pred : <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>pred x</code> is <code>x - 1</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(+)"><a href="#val-(+)" class="anchor"></a><code><span><span class="keyword">val</span> (+) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Integer addition. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(-)"><a href="#val-(-)" class="anchor"></a><code><span><span class="keyword">val</span> (-) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Integer subtraction. Left-associative operator, , see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(*)"><a href="#val-(*)" class="anchor"></a><code><span><span class="keyword">val</span> (*) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Integer multiplication. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(/)"><a href="#val-(/)" class="anchor"></a><code><span><span class="keyword">val</span> (/) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Integer division. Integer division rounds the real quotient of its arguments towards zero. More precisely, if <code>x &gt;= 0</code> and <code>y &gt; 0</code>, <code>x / y</code> is the greatest integer less than or equal to the real quotient of <code>x</code> by <code>y</code>. Moreover, <code>(- x) / y = x / (- y) = - (x / y)</code>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Division_by_zero</span> <p>if the second argument is 0.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(mod)"><a href="#val-(mod)" class="anchor"></a><code><span><span class="keyword">val</span> (mod) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Integer remainder. If <code>y</code> is not zero, the result of <code>x mod y</code> satisfies the following properties: <code>x = (x / y) * y + x mod y</code> and <code>abs(x mod y) &lt;= abs(y) - 1</code>. If <code>y = 0</code>, <code>x mod y</code> raises <code>Division_by_zero</code>. Note that <code>x mod y</code> is negative only if <code>x &lt; 0</code>. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Division_by_zero</span> <p>if <code>y</code> is zero.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-abs"><a href="#val-abs" class="anchor"></a><code><span><span class="keyword">val</span> abs : <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>abs x</code> is the absolute value of <code>x</code>. On <code>min_int</code> this is <code>min_int</code> itself and thus remains negative.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-max_int"><a href="#val-max_int" class="anchor"></a><code><span><span class="keyword">val</span> max_int : int</span></code></div><div class="spec-doc"><p>The greatest representable integer.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-min_int"><a href="#val-min_int" class="anchor"></a><code><span><span class="keyword">val</span> min_int : int</span></code></div><div class="spec-doc"><p>The smallest representable integer.</p></div></div><h3 id="bitwise-operations"><a href="#bitwise-operations" class="anchor"></a>Bitwise operations</h3><div class="odoc-spec"><div class="spec value external anchored" id="val-(land)"><a href="#val-(land)" class="anchor"></a><code><span><span class="keyword">val</span> (land) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Bitwise logical and. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(lor)"><a href="#val-(lor)" class="anchor"></a><code><span><span class="keyword">val</span> (lor) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Bitwise logical or. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(lxor)"><a href="#val-(lxor)" class="anchor"></a><code><span><span class="keyword">val</span> (lxor) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Bitwise logical exclusive or. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-lnot"><a href="#val-lnot" class="anchor"></a><code><span><span class="keyword">val</span> lnot : <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Bitwise logical negation.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(lsl)"><a href="#val-(lsl)" class="anchor"></a><code><span><span class="keyword">val</span> (lsl) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>n lsl m</code> shifts <code>n</code> to the left by <code>m</code> bits. The result is unspecified if <code>m &lt; 0</code> or <code>m &gt; Sys.int_size</code>. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(lsr)"><a href="#val-(lsr)" class="anchor"></a><code><span><span class="keyword">val</span> (lsr) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>n lsr m</code> shifts <code>n</code> to the right by <code>m</code> bits. This is a logical shift: zeroes are inserted regardless of the sign of <code>n</code>. The result is unspecified if <code>m &lt; 0</code> or <code>m &gt; Sys.int_size</code>. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(asr)"><a href="#val-(asr)" class="anchor"></a><code><span><span class="keyword">val</span> (asr) : <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>n asr m</code> shifts <code>n</code> to the right by <code>m</code> bits. This is an arithmetic shift: the sign bit of <code>n</code> is replicated. The result is unspecified if <code>m &lt; 0</code> or <code>m &gt; Sys.int_size</code>. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><h2 id="floating-point-arithmetic"><a href="#floating-point-arithmetic" class="anchor"></a>Floating-point arithmetic</h2><p>OCaml's floating-point numbers follow the IEEE 754 standard, using double precision (64 bits) numbers. Floating-point operations never raise an exception on overflow, underflow, division by zero, etc. Instead, special IEEE numbers are returned as appropriate, such as <code>infinity</code> for <code>1.0 /. 0.0</code>, <code>neg_infinity</code> for <code>-1.0 /. 0.0</code>, and <code>nan</code> ('not a number') for <code>0.0 /. 0.0</code>. These special numbers then propagate through floating-point computations as expected: for instance, <code>1.0 /. infinity</code> is <code>0.0</code>, basic arithmetic operations (<code>+.</code>, <code>-.</code>, <code>*.</code>, <code>/.</code>) with <code>nan</code> as an argument return <code>nan</code>, ...</p><div class="odoc-spec"><div class="spec value external anchored" id="val-(~-.)"><a href="#val-(~-.)" class="anchor"></a><code><span><span class="keyword">val</span> (~-.) : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Unary negation. You can also write <code>-. e</code> instead of <code>~-. e</code>. Unary operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(~+.)"><a href="#val-(~+.)" class="anchor"></a><code><span><span class="keyword">val</span> (~+.) : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Unary addition. You can also write <code>+. e</code> instead of <code>~+. e</code>. Unary operator, see <code>Ocaml_operators</code> for more information.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.12.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(+.)"><a href="#val-(+.)" class="anchor"></a><code><span><span class="keyword">val</span> (+.) : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Floating-point addition. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(-.)"><a href="#val-(-.)" class="anchor"></a><code><span><span class="keyword">val</span> (-.) : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Floating-point subtraction. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(*.)"><a href="#val-(*.)" class="anchor"></a><code><span><span class="keyword">val</span> (*.) : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Floating-point multiplication. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(/.)"><a href="#val-(/.)" class="anchor"></a><code><span><span class="keyword">val</span> (/.) : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Floating-point division. Left-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(**)"><a href="#val-(**)" class="anchor"></a><code><span><span class="keyword">val</span> (**) : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Exponentiation. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-sqrt"><a href="#val-sqrt" class="anchor"></a><code><span><span class="keyword">val</span> sqrt : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Square root.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-exp"><a href="#val-exp" class="anchor"></a><code><span><span class="keyword">val</span> exp : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Exponential.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-log"><a href="#val-log" class="anchor"></a><code><span><span class="keyword">val</span> log : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Natural logarithm.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-log10"><a href="#val-log10" class="anchor"></a><code><span><span class="keyword">val</span> log10 : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Base 10 logarithm.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-expm1"><a href="#val-expm1" class="anchor"></a><code><span><span class="keyword">val</span> expm1 : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p><code>expm1 x</code> computes <code>exp x -. 1.0</code>, giving numerically-accurate results even if <code>x</code> is close to <code>0.0</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.12.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-log1p"><a href="#val-log1p" class="anchor"></a><code><span><span class="keyword">val</span> log1p : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p><code>log1p x</code> computes <code>log(1.0 +. x)</code> (natural logarithm), giving numerically-accurate results even if <code>x</code> is close to <code>0.0</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.12.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-cos"><a href="#val-cos" class="anchor"></a><code><span><span class="keyword">val</span> cos : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Cosine. Argument is in radians.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-sin"><a href="#val-sin" class="anchor"></a><code><span><span class="keyword">val</span> sin : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Sine. Argument is in radians.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-tan"><a href="#val-tan" class="anchor"></a><code><span><span class="keyword">val</span> tan : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Tangent. Argument is in radians.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-acos"><a href="#val-acos" class="anchor"></a><code><span><span class="keyword">val</span> acos : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Arc cosine. The argument must fall within the range <code>[-1.0, 1.0]</code>. Result is in radians and is between <code>0.0</code> and <code>pi</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-asin"><a href="#val-asin" class="anchor"></a><code><span><span class="keyword">val</span> asin : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Arc sine. The argument must fall within the range <code>[-1.0, 1.0]</code>. Result is in radians and is between <code>-pi/2</code> and <code>pi/2</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-atan"><a href="#val-atan" class="anchor"></a><code><span><span class="keyword">val</span> atan : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Arc tangent. Result is in radians and is between <code>-pi/2</code> and <code>pi/2</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-atan2"><a href="#val-atan2" class="anchor"></a><code><span><span class="keyword">val</span> atan2 : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p><code>atan2 y x</code> returns the arc tangent of <code>y /. x</code>. The signs of <code>x</code> and <code>y</code> are used to determine the quadrant of the result. Result is in radians and is between <code>-pi</code> and <code>pi</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-hypot"><a href="#val-hypot" class="anchor"></a><code><span><span class="keyword">val</span> hypot : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p><code>hypot x y</code> returns <code>sqrt(x *. x + y *. y)</code>, that is, the length of the hypotenuse of a right-angled triangle with sides of length <code>x</code> and <code>y</code>, or, equivalently, the distance of the point <code>(x,y)</code> to origin. If one of <code>x</code> or <code>y</code> is infinite, returns <code>infinity</code> even if the other is <code>nan</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.00.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-cosh"><a href="#val-cosh" class="anchor"></a><code><span><span class="keyword">val</span> cosh : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Hyperbolic cosine. Argument is in radians.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-sinh"><a href="#val-sinh" class="anchor"></a><code><span><span class="keyword">val</span> sinh : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Hyperbolic sine. Argument is in radians.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-tanh"><a href="#val-tanh" class="anchor"></a><code><span><span class="keyword">val</span> tanh : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Hyperbolic tangent. Argument is in radians.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-acosh"><a href="#val-acosh" class="anchor"></a><code><span><span class="keyword">val</span> acosh : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Hyperbolic arc cosine. The argument must fall within the range <code>[1.0, inf]</code>. Result is in radians and is between <code>0.0</code> and <code>inf</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.13.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-asinh"><a href="#val-asinh" class="anchor"></a><code><span><span class="keyword">val</span> asinh : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Hyperbolic arc sine. The argument and result range over the entire real line. Result is in radians.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.13.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-atanh"><a href="#val-atanh" class="anchor"></a><code><span><span class="keyword">val</span> atanh : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Hyperbolic arc tangent. The argument must fall within the range <code>[-1.0, 1.0]</code>. Result is in radians and ranges over the entire real line.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.13.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-ceil"><a href="#val-ceil" class="anchor"></a><code><span><span class="keyword">val</span> ceil : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Round above to an integer value. <code>ceil f</code> returns the least integer value greater than or equal to <code>f</code>. The result is returned as a float.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-floor"><a href="#val-floor" class="anchor"></a><code><span><span class="keyword">val</span> floor : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Round below to an integer value. <code>floor f</code> returns the greatest integer value less than or equal to <code>f</code>. The result is returned as a float.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-abs_float"><a href="#val-abs_float" class="anchor"></a><code><span><span class="keyword">val</span> abs_float : <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p><code>abs_float f</code> returns the absolute value of <code>f</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-copysign"><a href="#val-copysign" class="anchor"></a><code><span><span class="keyword">val</span> copysign : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p><code>copysign x y</code> returns a float whose absolute value is that of <code>x</code> and whose sign is that of <code>y</code>. If <code>x</code> is <code>nan</code>, returns <code>nan</code>. If <code>y</code> is <code>nan</code>, returns either <code>x</code> or <code>-. x</code>, but it is not specified which.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.00.0</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-mod_float"><a href="#val-mod_float" class="anchor"></a><code><span><span class="keyword">val</span> mod_float : <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p><code>mod_float a b</code> returns the remainder of <code>a</code> with respect to <code>b</code>. The returned value is <code>a -. n *. b</code>, where <code>n</code> is the quotient <code>a /. b</code> rounded towards zero to an integer.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-frexp"><a href="#val-frexp" class="anchor"></a><code><span><span class="keyword">val</span> frexp : <span>float <span class="arrow">&#45;&gt;</span></span> float * int</span></code></div><div class="spec-doc"><p><code>frexp f</code> returns the pair of the significant and the exponent of <code>f</code>. When <code>f</code> is zero, the significant <code>x</code> and the exponent <code>n</code> of <code>f</code> are equal to zero. When <code>f</code> is non-zero, they are defined by <code>f = x *. 2 ** n</code> and <code>0.5 &lt;= x &lt; 1.0</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-ldexp"><a href="#val-ldexp" class="anchor"></a><code><span><span class="keyword">val</span> ldexp : <span>float <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p><code>ldexp x n</code> returns <code>x *. 2 ** n</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-modf"><a href="#val-modf" class="anchor"></a><code><span><span class="keyword">val</span> modf : <span>float <span class="arrow">&#45;&gt;</span></span> float * float</span></code></div><div class="spec-doc"><p><code>modf f</code> returns the pair of the fractional and integral part of <code>f</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-float"><a href="#val-float" class="anchor"></a><code><span><span class="keyword">val</span> float : <span>int <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Same as <a href="#val-float_of_int"><code>Stdlib.float_of_int</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-float_of_int"><a href="#val-float_of_int" class="anchor"></a><code><span><span class="keyword">val</span> float_of_int : <span>int <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Convert an integer to floating-point.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-truncate"><a href="#val-truncate" class="anchor"></a><code><span><span class="keyword">val</span> truncate : <span>float <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Same as <a href="#val-int_of_float"><code>Stdlib.int_of_float</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-int_of_float"><a href="#val-int_of_float" class="anchor"></a><code><span><span class="keyword">val</span> int_of_float : <span>float <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Truncate the given floating-point number to an integer. The result is unspecified if the argument is <code>nan</code> or falls outside the range of representable integers.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-infinity"><a href="#val-infinity" class="anchor"></a><code><span><span class="keyword">val</span> infinity : float</span></code></div><div class="spec-doc"><p>Positive infinity.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-neg_infinity"><a href="#val-neg_infinity" class="anchor"></a><code><span><span class="keyword">val</span> neg_infinity : float</span></code></div><div class="spec-doc"><p>Negative infinity.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-nan"><a href="#val-nan" class="anchor"></a><code><span><span class="keyword">val</span> nan : float</span></code></div><div class="spec-doc"><p>A special floating-point value denoting the result of an undefined operation such as <code>0.0 /. 0.0</code>. Stands for 'not a number'. Any floating-point operation with <code>nan</code> as argument returns <code>nan</code> as result. As for floating-point comparisons, <code>=</code>, <code>&lt;</code>, <code>&lt;=</code>, <code>&gt;</code> and <code>&gt;=</code> return <code>false</code> and <code>&lt;&gt;</code> returns <code>true</code> if one or both of their arguments is <code>nan</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-max_float"><a href="#val-max_float" class="anchor"></a><code><span><span class="keyword">val</span> max_float : float</span></code></div><div class="spec-doc"><p>The largest positive finite value of type <code>float</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-min_float"><a href="#val-min_float" class="anchor"></a><code><span><span class="keyword">val</span> min_float : float</span></code></div><div class="spec-doc"><p>The smallest positive, non-zero, non-denormalized value of type <code>float</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-epsilon_float"><a href="#val-epsilon_float" class="anchor"></a><code><span><span class="keyword">val</span> epsilon_float : float</span></code></div><div class="spec-doc"><p>The difference between <code>1.0</code> and the smallest exactly representable floating-point number greater than <code>1.0</code>.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-fpclass"><a href="#type-fpclass" class="anchor"></a><code><span><span class="keyword">type</span> fpclass</span><span> = </span></code><ol><li id="type-fpclass.FP_normal" class="def variant constructor anchored"><a href="#type-fpclass.FP_normal" class="anchor"></a><code><span>| </span><span><span class="constructor">FP_normal</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Normal number, none of the below</p><span class="comment-delim">*)</span></div></li><li id="type-fpclass.FP_subnormal" class="def variant constructor anchored"><a href="#type-fpclass.FP_subnormal" class="anchor"></a><code><span>| </span><span><span class="constructor">FP_subnormal</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Number very close to 0.0, has reduced precision</p><span class="comment-delim">*)</span></div></li><li id="type-fpclass.FP_zero" class="def variant constructor anchored"><a href="#type-fpclass.FP_zero" class="anchor"></a><code><span>| </span><span><span class="constructor">FP_zero</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Number is 0.0 or -0.0</p><span class="comment-delim">*)</span></div></li><li id="type-fpclass.FP_infinite" class="def variant constructor anchored"><a href="#type-fpclass.FP_infinite" class="anchor"></a><code><span>| </span><span><span class="constructor">FP_infinite</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Number is positive or negative infinity</p><span class="comment-delim">*)</span></div></li><li id="type-fpclass.FP_nan" class="def variant constructor anchored"><a href="#type-fpclass.FP_nan" class="anchor"></a><code><span>| </span><span><span class="constructor">FP_nan</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Not a number: result of an undefined operation</p><span class="comment-delim">*)</span></div></li></ol></div><div class="spec-doc"><p>The five classes of floating-point numbers, as determined by the <a href="#val-classify_float"><code>Stdlib.classify_float</code></a> function.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-classify_float"><a href="#val-classify_float" class="anchor"></a><code><span><span class="keyword">val</span> classify_float : <span>float <span class="arrow">&#45;&gt;</span></span> <a href="#type-fpclass">fpclass</a></span></code></div><div class="spec-doc"><p>Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number.</p></div></div><h2 id="string-operations"><a href="#string-operations" class="anchor"></a>String operations</h2><p>More string operations are provided in module <a href="String/index.html"><code>String</code></a>.</p><div class="odoc-spec"><div class="spec value anchored" id="val-(^)"><a href="#val-(^)" class="anchor"></a><code><span><span class="keyword">val</span> (^) : <span>string <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>String concatenation. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Invalid_argument</span> <p>if the result is longer then than <a href="Sys/index.html#val-max_string_length"><code>Sys.max_string_length</code></a> bytes.</p></li></ul></div></div><h2 id="character-operations"><a href="#character-operations" class="anchor"></a>Character operations</h2><p>More character operations are provided in module <a href="Char/index.html"><code>Char</code></a>.</p><div class="odoc-spec"><div class="spec value external anchored" id="val-int_of_char"><a href="#val-int_of_char" class="anchor"></a><code><span><span class="keyword">val</span> int_of_char : <span>char <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Return the ASCII code of the argument.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-char_of_int"><a href="#val-char_of_int" class="anchor"></a><code><span><span class="keyword">val</span> char_of_int : <span>int <span class="arrow">&#45;&gt;</span></span> char</span></code></div><div class="spec-doc"><p>Return the character with the given ASCII code.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Invalid_argument</span> <p>if the argument is outside the range 0--255.</p></li></ul></div></div><h2 id="unit-operations"><a href="#unit-operations" class="anchor"></a>Unit operations</h2><div class="odoc-spec"><div class="spec value external anchored" id="val-ignore"><a href="#val-ignore" class="anchor"></a><code><span><span class="keyword">val</span> ignore : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Discard the value of its argument and return <code>()</code>. For instance, <code>ignore(f x)</code> discards the result of the side-effecting function <code>f</code>. It is equivalent to <code>f x; ()</code>, except that the latter may generate a compiler warning; writing <code>ignore(f x)</code> instead avoids the warning.</p></div></div><h2 id="string-conversion-functions"><a href="#string-conversion-functions" class="anchor"></a>String conversion functions</h2><div class="odoc-spec"><div class="spec value anchored" id="val-string_of_bool"><a href="#val-string_of_bool" class="anchor"></a><code><span><span class="keyword">val</span> string_of_bool : <span>bool <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Return the string representation of a boolean. As the returned values may be shared, the user should not modify them directly.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-bool_of_string_opt"><a href="#val-bool_of_string_opt" class="anchor"></a><code><span><span class="keyword">val</span> bool_of_string_opt : <span>string <span class="arrow">&#45;&gt;</span></span> <span>bool option</span></span></code></div><div class="spec-doc"><p>Convert the given string to a boolean.</p><p>Return <code>None</code> if the string is not <code>&quot;true&quot;</code> or <code>&quot;false&quot;</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.05</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-bool_of_string"><a href="#val-bool_of_string" class="anchor"></a><code><span><span class="keyword">val</span> bool_of_string : <span>string <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>Same as <a href="#val-bool_of_string_opt"><code>Stdlib.bool_of_string_opt</code></a>, but raise <code>Invalid_argument &quot;bool_of_string&quot;</code> instead of returning <code>None</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-string_of_int"><a href="#val-string_of_int" class="anchor"></a><code><span><span class="keyword">val</span> string_of_int : <span>int <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Return the string representation of an integer, in decimal.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-int_of_string_opt"><a href="#val-int_of_string_opt" class="anchor"></a><code><span><span class="keyword">val</span> int_of_string_opt : <span>string <span class="arrow">&#45;&gt;</span></span> <span>int option</span></span></code></div><div class="spec-doc"><p>Convert the given string to an integer. The string is read in decimal (by default, or if the string begins with <code>0u</code>), in hexadecimal (if it begins with <code>0x</code> or <code>0X</code>), in octal (if it begins with <code>0o</code> or <code>0O</code>), or in binary (if it begins with <code>0b</code> or <code>0B</code>).</p><p>The <code>0u</code> prefix reads the input as an unsigned integer in the range <code>[0, 2*max_int+1]</code>. If the input exceeds <a href="#val-max_int"><code>max_int</code></a> it is converted to the signed integer <code>min_int + input - max_int - 1</code>.</p><p>The <code>_</code> (underscore) character can appear anywhere in the string and is ignored.</p><p>Return <code>None</code> if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type <code>int</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.05</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-int_of_string"><a href="#val-int_of_string" class="anchor"></a><code><span><span class="keyword">val</span> int_of_string : <span>string <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Same as <a href="#val-int_of_string_opt"><code>Stdlib.int_of_string_opt</code></a>, but raise <code>Failure &quot;int_of_string&quot;</code> instead of returning <code>None</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-string_of_float"><a href="#val-string_of_float" class="anchor"></a><code><span><span class="keyword">val</span> string_of_float : <span>float <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Return a string representation of a floating-point number.</p><p>This conversion can involve a loss of precision. For greater control over the manner in which the number is printed, see <a href="Printf/index.html"><code>Printf</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-float_of_string_opt"><a href="#val-float_of_string_opt" class="anchor"></a><code><span><span class="keyword">val</span> float_of_string_opt : <span>string <span class="arrow">&#45;&gt;</span></span> <span>float option</span></span></code></div><div class="spec-doc"><p>Convert the given string to a float. The string is read in decimal (by default) or in hexadecimal (marked by <code>0x</code> or <code>0X</code>).</p><p>The format of decimal floating-point numbers is <code> [-] dd.ddd (e|E) [+|-] dd </code>, where <code>d</code> stands for a decimal digit.</p><p>The format of hexadecimal floating-point numbers is <code> [-] 0(x|X) hh.hhh (p|P) [+|-] dd </code>, where <code>h</code> stands for an hexadecimal digit and <code>d</code> for a decimal digit.</p><p>In both cases, at least one of the integer and fractional parts must be given; the exponent part is optional.</p><p>The <code>_</code> (underscore) character can appear anywhere in the string and is ignored.</p><p>Depending on the execution platforms, other representations of floating-point numbers can be accepted, but should not be relied upon.</p><p>Return <code>None</code> if the given string is not a valid representation of a float.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.05</li></ul></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-float_of_string"><a href="#val-float_of_string" class="anchor"></a><code><span><span class="keyword">val</span> float_of_string : <span>string <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Same as <a href="#val-float_of_string_opt"><code>Stdlib.float_of_string_opt</code></a>, but raise <code>Failure &quot;float_of_string&quot;</code> instead of returning <code>None</code>.</p></div></div><h2 id="pair-operations"><a href="#pair-operations" class="anchor"></a>Pair operations</h2><div class="odoc-spec"><div class="spec value external anchored" id="val-fst"><a href="#val-fst" class="anchor"></a><code><span><span class="keyword">val</span> fst : <span><span>(<span class="type-var">'a</span> * <span class="type-var">'b</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Return the first component of a pair.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-snd"><a href="#val-snd" class="anchor"></a><code><span><span class="keyword">val</span> snd : <span><span>(<span class="type-var">'a</span> * <span class="type-var">'b</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p>Return the second component of a pair.</p></div></div><h2 id="list-operations"><a href="#list-operations" class="anchor"></a>List operations</h2><p>More list operations are provided in module <a href="List/index.html"><code>List</code></a>.</p><div class="odoc-spec"><div class="spec value anchored" id="val-(@)"><a href="#val-(@)" class="anchor"></a><code><span><span class="keyword">val</span> (@) : <span><span><span class="type-var">'a</span> list</span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> list</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> list</span></span></code></div><div class="spec-doc"><p>List concatenation. Not tail-recursive (length of the first argument). Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><h2 id="input/output"><a href="#input/output" class="anchor"></a>Input/output</h2><p>Note: all input/output functions can raise <code>Sys_error</code> when the system calls they invoke fail.</p><div class="odoc-spec"><div class="spec type anchored" id="type-in_channel"><a href="#type-in_channel" class="anchor"></a><code><span><span class="keyword">type</span> in_channel</span></code></div><div class="spec-doc"><p>The type of input channel.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-out_channel"><a href="#type-out_channel" class="anchor"></a><code><span><span class="keyword">type</span> out_channel</span></code></div><div class="spec-doc"><p>The type of output channel.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-stdin"><a href="#val-stdin" class="anchor"></a><code><span><span class="keyword">val</span> stdin : <a href="#type-in_channel">in_channel</a></span></code></div><div class="spec-doc"><p>The standard input for the process.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-stdout"><a href="#val-stdout" class="anchor"></a><code><span><span class="keyword">val</span> stdout : <a href="#type-out_channel">out_channel</a></span></code></div><div class="spec-doc"><p>The standard output for the process.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-stderr"><a href="#val-stderr" class="anchor"></a><code><span><span class="keyword">val</span> stderr : <a href="#type-out_channel">out_channel</a></span></code></div><div class="spec-doc"><p>The standard error output for the process.</p></div></div><h3 id="output-functions-on-standard-output"><a href="#output-functions-on-standard-output" class="anchor"></a>Output functions on standard output</h3><div class="odoc-spec"><div class="spec value anchored" id="val-print_char"><a href="#val-print_char" class="anchor"></a><code><span><span class="keyword">val</span> print_char : <span>char <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a character on standard output.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print_string"><a href="#val-print_string" class="anchor"></a><code><span><span class="keyword">val</span> print_string : <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a string on standard output.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print_bytes"><a href="#val-print_bytes" class="anchor"></a><code><span><span class="keyword">val</span> print_bytes : <span>bytes <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a byte sequence on standard output.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print_int"><a href="#val-print_int" class="anchor"></a><code><span><span class="keyword">val</span> print_int : <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print an integer, in decimal, on standard output.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print_float"><a href="#val-print_float" class="anchor"></a><code><span><span class="keyword">val</span> print_float : <span>float <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a floating-point number, in decimal, on standard output.</p><p>The conversion of the number to a string uses <a href="#val-string_of_float"><code>string_of_float</code></a> and can involve a loss of precision.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print_endline"><a href="#val-print_endline" class="anchor"></a><code><span><span class="keyword">val</span> print_endline : <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a string, followed by a newline character, on standard output and flush standard output.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print_newline"><a href="#val-print_newline" class="anchor"></a><code><span><span class="keyword">val</span> print_newline : <span>unit <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a newline character on standard output, and flush standard output. This can be used to simulate line buffering of standard output.</p></div></div><h3 id="output-functions-on-standard-error"><a href="#output-functions-on-standard-error" class="anchor"></a>Output functions on standard error</h3><div class="odoc-spec"><div class="spec value anchored" id="val-prerr_char"><a href="#val-prerr_char" class="anchor"></a><code><span><span class="keyword">val</span> prerr_char : <span>char <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a character on standard error.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-prerr_string"><a href="#val-prerr_string" class="anchor"></a><code><span><span class="keyword">val</span> prerr_string : <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a string on standard error.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-prerr_bytes"><a href="#val-prerr_bytes" class="anchor"></a><code><span><span class="keyword">val</span> prerr_bytes : <span>bytes <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a byte sequence on standard error.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-prerr_int"><a href="#val-prerr_int" class="anchor"></a><code><span><span class="keyword">val</span> prerr_int : <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print an integer, in decimal, on standard error.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-prerr_float"><a href="#val-prerr_float" class="anchor"></a><code><span><span class="keyword">val</span> prerr_float : <span>float <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a floating-point number, in decimal, on standard error.</p><p>The conversion of the number to a string uses <a href="#val-string_of_float"><code>string_of_float</code></a> and can involve a loss of precision.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-prerr_endline"><a href="#val-prerr_endline" class="anchor"></a><code><span><span class="keyword">val</span> prerr_endline : <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a string, followed by a newline character on standard error and flush standard error.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-prerr_newline"><a href="#val-prerr_newline" class="anchor"></a><code><span><span class="keyword">val</span> prerr_newline : <span>unit <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Print a newline character on standard error, and flush standard error.</p></div></div><h3 id="input-functions-on-standard-input"><a href="#input-functions-on-standard-input" class="anchor"></a>Input functions on standard input</h3><div class="odoc-spec"><div class="spec value anchored" id="val-read_line"><a href="#val-read_line" class="anchor"></a><code><span><span class="keyword">val</span> read_line : <span>unit <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Flush standard output, then read characters from standard input until a newline character is encountered.</p><p>Return the string of all characters read, without the newline character at the end.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">End_of_file</span> <p>if the end of the file is reached at the beginning of line.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read_int_opt"><a href="#val-read_int_opt" class="anchor"></a><code><span><span class="keyword">val</span> read_int_opt : <span>unit <span class="arrow">&#45;&gt;</span></span> <span>int option</span></span></code></div><div class="spec-doc"><p>Flush standard output, then read one line from standard input and convert it to an integer.</p><p>Return <code>None</code> if the line read is not a valid representation of an integer.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.05</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read_int"><a href="#val-read_int" class="anchor"></a><code><span><span class="keyword">val</span> read_int : <span>unit <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Same as <a href="#val-read_int_opt"><code>Stdlib.read_int_opt</code></a>, but raise <code>Failure &quot;int_of_string&quot;</code> instead of returning <code>None</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read_float_opt"><a href="#val-read_float_opt" class="anchor"></a><code><span><span class="keyword">val</span> read_float_opt : <span>unit <span class="arrow">&#45;&gt;</span></span> <span>float option</span></span></code></div><div class="spec-doc"><p>Flush standard output, then read one line from standard input and convert it to a floating-point number.</p><p>Return <code>None</code> if the line read is not a valid representation of a floating-point number.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.05.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read_float"><a href="#val-read_float" class="anchor"></a><code><span><span class="keyword">val</span> read_float : <span>unit <span class="arrow">&#45;&gt;</span></span> float</span></code></div><div class="spec-doc"><p>Same as <a href="#val-read_float_opt"><code>Stdlib.read_float_opt</code></a>, but raise <code>Failure &quot;float_of_string&quot;</code> instead of returning <code>None</code>.</p></div></div><h3 id="general-output-functions"><a href="#general-output-functions" class="anchor"></a>General output functions</h3><div class="odoc-spec"><div class="spec type anchored" id="type-open_flag"><a href="#type-open_flag" class="anchor"></a><code><span><span class="keyword">type</span> open_flag</span><span> = </span></code><ol><li id="type-open_flag.Open_rdonly" class="def variant constructor anchored"><a href="#type-open_flag.Open_rdonly" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_rdonly</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>open for reading.</p><span class="comment-delim">*)</span></div></li><li id="type-open_flag.Open_wronly" class="def variant constructor anchored"><a href="#type-open_flag.Open_wronly" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_wronly</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>open for writing.</p><span class="comment-delim">*)</span></div></li><li id="type-open_flag.Open_append" class="def variant constructor anchored"><a href="#type-open_flag.Open_append" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_append</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>open for appending: always write at end of file.</p><span class="comment-delim">*)</span></div></li><li id="type-open_flag.Open_creat" class="def variant constructor anchored"><a href="#type-open_flag.Open_creat" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_creat</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>create the file if it does not exist.</p><span class="comment-delim">*)</span></div></li><li id="type-open_flag.Open_trunc" class="def variant constructor anchored"><a href="#type-open_flag.Open_trunc" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_trunc</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>empty the file if it already exists.</p><span class="comment-delim">*)</span></div></li><li id="type-open_flag.Open_excl" class="def variant constructor anchored"><a href="#type-open_flag.Open_excl" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_excl</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>fail if Open_creat and the file already exists.</p><span class="comment-delim">*)</span></div></li><li id="type-open_flag.Open_binary" class="def variant constructor anchored"><a href="#type-open_flag.Open_binary" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_binary</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>open in binary mode (no conversion).</p><span class="comment-delim">*)</span></div></li><li id="type-open_flag.Open_text" class="def variant constructor anchored"><a href="#type-open_flag.Open_text" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_text</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>open in text mode (may perform conversions).</p><span class="comment-delim">*)</span></div></li><li id="type-open_flag.Open_nonblock" class="def variant constructor anchored"><a href="#type-open_flag.Open_nonblock" class="anchor"></a><code><span>| </span><span><span class="constructor">Open_nonblock</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>open in non-blocking mode.</p><span class="comment-delim">*)</span></div></li></ol></div><div class="spec-doc"><p>Opening modes for <a href="#val-open_out_gen"><code>Stdlib.open_out_gen</code></a> and <a href="#val-open_in_gen"><code>Stdlib.open_in_gen</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-open_out"><a href="#val-open_out" class="anchor"></a><code><span><span class="keyword">val</span> open_out : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-out_channel">out_channel</a></span></code></div><div class="spec-doc"><p>Open the named file for writing, and return a new output channel on that file, positioned at the beginning of the file. The file is truncated to zero length if it already exists. It is created if it does not already exists.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-open_out_bin"><a href="#val-open_out_bin" class="anchor"></a><code><span><span class="keyword">val</span> open_out_bin : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-out_channel">out_channel</a></span></code></div><div class="spec-doc"><p>Same as <a href="#val-open_out"><code>Stdlib.open_out</code></a>, but the file is opened in binary mode, so that no translation takes place during writes. On operating systems that do not distinguish between text mode and binary mode, this function behaves like <a href="#val-open_out"><code>Stdlib.open_out</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-open_out_gen"><a href="#val-open_out_gen" class="anchor"></a><code><span><span class="keyword">val</span> open_out_gen : <span><span><a href="#type-open_flag">open_flag</a> list</span> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-out_channel">out_channel</a></span></code></div><div class="spec-doc"><p><code>open_out_gen mode perm filename</code> opens the named file for writing, as described above. The extra argument <code>mode</code> specifies the opening mode. The extra argument <code>perm</code> specifies the file permissions, in case the file must be created. <a href="#val-open_out"><code>Stdlib.open_out</code></a> and <a href="#val-open_out_bin"><code>Stdlib.open_out_bin</code></a> are special cases of this function.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-flush"><a href="#val-flush" class="anchor"></a><code><span><span class="keyword">val</span> flush : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Flush the buffer associated with the given output channel, performing all pending writes on that channel. Interactive programs must be careful about flushing standard output and standard error at the right time.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-flush_all"><a href="#val-flush_all" class="anchor"></a><code><span><span class="keyword">val</span> flush_all : <span>unit <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Flush all open output channels; ignore errors.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output_char"><a href="#val-output_char" class="anchor"></a><code><span><span class="keyword">val</span> output_char : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>char <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write the character on the given output channel.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output_string"><a href="#val-output_string" class="anchor"></a><code><span><span class="keyword">val</span> output_string : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write the string on the given output channel.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output_bytes"><a href="#val-output_bytes" class="anchor"></a><code><span><span class="keyword">val</span> output_bytes : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>bytes <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write the byte sequence on the given output channel.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output"><a href="#val-output" class="anchor"></a><code><span><span class="keyword">val</span> output : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>bytes <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>output oc buf pos len</code> writes <code>len</code> characters from byte sequence <code>buf</code>, starting at offset <code>pos</code>, to the given output channel <code>oc</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Invalid_argument</span> <p>if <code>pos</code> and <code>len</code> do not designate a valid range of <code>buf</code>.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output_substring"><a href="#val-output_substring" class="anchor"></a><code><span><span class="keyword">val</span> output_substring : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Same as <code>output</code> but take a string as argument instead of a byte sequence.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output_byte"><a href="#val-output_byte" class="anchor"></a><code><span><span class="keyword">val</span> output_byte : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output_binary_int"><a href="#val-output_binary_int" class="anchor"></a><code><span><span class="keyword">val</span> output_binary_int : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write one integer in binary format (4 bytes, big-endian) on the given output channel. The given integer is taken modulo 2<sup>32</sup>. The only reliable way to read it back is through the <a href="#val-input_binary_int"><code>Stdlib.input_binary_int</code></a> function. The format is compatible across all machines for a given version of OCaml.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-output_value"><a href="#val-output_value" class="anchor"></a><code><span><span class="keyword">val</span> output_value : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write the representation of a structured value of any type to a channel. Circularities and sharing inside the value are detected and preserved. The object can be read back, by the function <a href="#val-input_value"><code>Stdlib.input_value</code></a>. See the description of module <a href="Marshal/index.html"><code>Marshal</code></a> for more information. <a href="#val-output_value"><code>Stdlib.output_value</code></a> is equivalent to <a href="Marshal/index.html#val-to_channel"><code>Marshal.to_channel</code></a> with an empty list of flags.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-seek_out"><a href="#val-seek_out" class="anchor"></a><code><span><span class="keyword">val</span> seek_out : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>seek_out chan pos</code> sets the current writing position to <code>pos</code> for channel <code>chan</code>. This works only for regular files. On files of other kinds (such as terminals, pipes and sockets), the behavior is unspecified.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pos_out"><a href="#val-pos_out" class="anchor"></a><code><span><span class="keyword">val</span> pos_out : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Return the current writing position for the given channel. Does not work on channels opened with the <code>Open_append</code> flag (returns unspecified results). For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with <code>pos_out</code>, then going back to this position using <code>seek_out</code> will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-out_channel_length"><a href="#val-out_channel_length" class="anchor"></a><code><span><span class="keyword">val</span> out_channel_length : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-close_out"><a href="#val-close_out" class="anchor"></a><code><span><span class="keyword">val</span> close_out : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Close the given channel, flushing all buffered write operations. Output functions raise a <code>Sys_error</code> exception when they are applied to a closed output channel, except <code>close_out</code> and <code>flush</code>, which do nothing when applied to an already closed channel. Note that <code>close_out</code> may raise <code>Sys_error</code> if the operating system signals an error when flushing or closing.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-close_out_noerr"><a href="#val-close_out_noerr" class="anchor"></a><code><span><span class="keyword">val</span> close_out_noerr : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Same as <code>close_out</code>, but ignore all errors.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_binary_mode_out"><a href="#val-set_binary_mode_out" class="anchor"></a><code><span><span class="keyword">val</span> set_binary_mode_out : <span><a href="#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>bool <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>set_binary_mode_out oc true</code> sets the channel <code>oc</code> to binary mode: no translations take place during output. <code>set_binary_mode_out oc false</code> sets the channel <code>oc</code> to text mode: depending on the operating system, some translations may take place during output. For instance, under Windows, end-of-lines will be translated from <code>\n</code> to <code>\r\n</code>. This function has no effect under operating systems that do not distinguish between text mode and binary mode.</p></div></div><h3 id="general-input-functions"><a href="#general-input-functions" class="anchor"></a>General input functions</h3><div class="odoc-spec"><div class="spec value anchored" id="val-open_in"><a href="#val-open_in" class="anchor"></a><code><span><span class="keyword">val</span> open_in : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-in_channel">in_channel</a></span></code></div><div class="spec-doc"><p>Open the named file for reading, and return a new input channel on that file, positioned at the beginning of the file.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-open_in_bin"><a href="#val-open_in_bin" class="anchor"></a><code><span><span class="keyword">val</span> open_in_bin : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-in_channel">in_channel</a></span></code></div><div class="spec-doc"><p>Same as <a href="#val-open_in"><code>Stdlib.open_in</code></a>, but the file is opened in binary mode, so that no translation takes place during reads. On operating systems that do not distinguish between text mode and binary mode, this function behaves like <a href="#val-open_in"><code>Stdlib.open_in</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-open_in_gen"><a href="#val-open_in_gen" class="anchor"></a><code><span><span class="keyword">val</span> open_in_gen : <span><span><a href="#type-open_flag">open_flag</a> list</span> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-in_channel">in_channel</a></span></code></div><div class="spec-doc"><p><code>open_in_gen mode perm filename</code> opens the named file for reading, as described above. The extra arguments <code>mode</code> and <code>perm</code> specify the opening mode and file permissions. <a href="#val-open_in"><code>Stdlib.open_in</code></a> and <a href="#val-open_in_bin"><code>Stdlib.open_in_bin</code></a> are special cases of this function.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-input_char"><a href="#val-input_char" class="anchor"></a><code><span><span class="keyword">val</span> input_char : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> char</span></code></div><div class="spec-doc"><p>Read one character from the given input channel.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">End_of_file</span> <p>if there are no more characters to read.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-input_line"><a href="#val-input_line" class="anchor"></a><code><span><span class="keyword">val</span> input_line : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Read characters from the given input channel, until a newline character is encountered. Return the string of all characters read, without the newline character at the end.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">End_of_file</span> <p>if the end of the file is reached at the beginning of line.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-input"><a href="#val-input" class="anchor"></a><code><span><span class="keyword">val</span> input : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>bytes <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>input ic buf pos len</code> reads up to <code>len</code> characters from the given channel <code>ic</code>, storing them in byte sequence <code>buf</code>, starting at character number <code>pos</code>. It returns the actual number of characters read, between 0 and <code>len</code> (inclusive). A return value of 0 means that the end of file was reached. A return value between 0 and <code>len</code> exclusive means that not all requested <code>len</code> characters were read, either because no more characters were available at that time, or because the implementation found it convenient to do a partial read; <code>input</code> must be called again to read the remaining characters, if desired. (See also <a href="#val-really_input"><code>Stdlib.really_input</code></a> for reading exactly <code>len</code> characters.) Exception <code>Invalid_argument &quot;input&quot;</code> is raised if <code>pos</code> and <code>len</code> do not designate a valid range of <code>buf</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-really_input"><a href="#val-really_input" class="anchor"></a><code><span><span class="keyword">val</span> really_input : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>bytes <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>really_input ic buf pos len</code> reads <code>len</code> characters from channel <code>ic</code>, storing them in byte sequence <code>buf</code>, starting at character number <code>pos</code>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">End_of_file</span> <p>if the end of file is reached before <code>len</code> characters have been read.</p></li></ul><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">Invalid_argument</span> <p>if <code>pos</code> and <code>len</code> do not designate a valid range of <code>buf</code>.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-really_input_string"><a href="#val-really_input_string" class="anchor"></a><code><span><span class="keyword">val</span> really_input_string : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p><code>really_input_string ic len</code> reads <code>len</code> characters from channel <code>ic</code> and returns them in a new string.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">End_of_file</span> <p>if the end of file is reached before <code>len</code> characters have been read.</p></li></ul><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.02.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-input_byte"><a href="#val-input_byte" class="anchor"></a><code><span><span class="keyword">val</span> input_byte : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Same as <a href="#val-input_char"><code>Stdlib.input_char</code></a>, but return the 8-bit integer representing the character.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">End_of_file</span> <p>if the end of file was reached.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-input_binary_int"><a href="#val-input_binary_int" class="anchor"></a><code><span><span class="keyword">val</span> input_binary_int : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Read an integer encoded in binary format (4 bytes, big-endian) from the given input channel. See <a href="#val-output_binary_int"><code>Stdlib.output_binary_int</code></a>.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <span class="value">End_of_file</span> <p>if the end of file was reached while reading the integer.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-input_value"><a href="#val-input_value" class="anchor"></a><code><span><span class="keyword">val</span> input_value : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Read the representation of a structured value, as produced by <a href="#val-output_value"><code>Stdlib.output_value</code></a>, and return the corresponding value. This function is identical to <a href="Marshal/index.html#val-from_channel"><code>Marshal.from_channel</code></a>; see the description of module <a href="Marshal/index.html"><code>Marshal</code></a> for more information, in particular concerning the lack of type safety.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-seek_in"><a href="#val-seek_in" class="anchor"></a><code><span><span class="keyword">val</span> seek_in : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>seek_in chan pos</code> sets the current reading position to <code>pos</code> for channel <code>chan</code>. This works only for regular files. On files of other kinds, the behavior is unspecified.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pos_in"><a href="#val-pos_in" class="anchor"></a><code><span><span class="keyword">val</span> pos_in : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with <code>pos_in</code>, then going back to this position using <code>seek_in</code> will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-in_channel_length"><a href="#val-in_channel_length" class="anchor"></a><code><span><span class="keyword">val</span> in_channel_length : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-close_in"><a href="#val-close_in" class="anchor"></a><code><span><span class="keyword">val</span> close_in : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Close the given channel. Input functions raise a <code>Sys_error</code> exception when they are applied to a closed input channel, except <code>close_in</code>, which does nothing when applied to an already closed channel.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-close_in_noerr"><a href="#val-close_in_noerr" class="anchor"></a><code><span><span class="keyword">val</span> close_in_noerr : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Same as <code>close_in</code>, but ignore all errors.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_binary_mode_in"><a href="#val-set_binary_mode_in" class="anchor"></a><code><span><span class="keyword">val</span> set_binary_mode_in : <span><a href="#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span>bool <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>set_binary_mode_in ic true</code> sets the channel <code>ic</code> to binary mode: no translations take place during input. <code>set_binary_mode_out ic false</code> sets the channel <code>ic</code> to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from <code>\r\n</code> to <code>\n</code>. This function has no effect under operating systems that do not distinguish between text mode and binary mode.</p></div></div><h3 id="operations-on-large-files"><a href="#operations-on-large-files" class="anchor"></a>Operations on large files</h3><div class="odoc-spec"><div class="spec module anchored" id="module-LargeFile"><a href="#module-LargeFile" class="anchor"></a><code><span><span class="keyword">module</span> <a href="LargeFile/index.html">LargeFile</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Operations on large files. This sub-module provides 64-bit variants of the channel functions that manipulate file positions and file sizes. By representing positions and sizes by 64-bit integers (type <code>int64</code>) instead of regular integers (type <code>int</code>), these alternate functions allow operating on files whose sizes are greater than <code>max_int</code>.</p></div></div><h2 id="references"><a href="#references" class="anchor"></a>References</h2><div class="odoc-spec"><div class="spec type anchored" id="type-ref"><a href="#type-ref" class="anchor"></a><code><span><span class="keyword">type</span> <span>'a ref</span></span><span> = </span><span>{</span></code><ol><li id="type-ref.contents" class="def record field anchored"><a href="#type-ref.contents" class="anchor"></a><code><span><span class="keyword">mutable</span> contents : <span class="type-var">'a</span>;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>The type of references (mutable indirection cells) containing a value of type <code>'a</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-ref"><a href="#val-ref" class="anchor"></a><code><span><span class="keyword">val</span> ref : <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <a href="#type-ref">ref</a></span></span></code></div><div class="spec-doc"><p>Return a fresh reference containing the given value.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(!)"><a href="#val-(!)" class="anchor"></a><code><span><span class="keyword">val</span> (!) : <span><span><span class="type-var">'a</span> <a href="#type-ref">ref</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>!r</code> returns the current contents of reference <code>r</code>. Equivalent to <code>fun r -&gt; r.contents</code>. Unary operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-(:=)"><a href="#val-(:=)" class="anchor"></a><code><span><span class="keyword">val</span> (:=) : <span><span><span class="type-var">'a</span> <a href="#type-ref">ref</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>r := a</code> stores the value of <code>a</code> in reference <code>r</code>. Equivalent to <code>fun r v -&gt; r.contents &lt;- v</code>. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-incr"><a href="#val-incr" class="anchor"></a><code><span><span class="keyword">val</span> incr : <span><span>int <a href="#type-ref">ref</a></span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Increment the integer contained in the given reference. Equivalent to <code>fun r -&gt; r := succ !r</code>.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-decr"><a href="#val-decr" class="anchor"></a><code><span><span class="keyword">val</span> decr : <span><span>int <a href="#type-ref">ref</a></span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Decrement the integer contained in the given reference. Equivalent to <code>fun r -&gt; r := pred !r</code>.</p></div></div><h2 id="result-type"><a href="#result-type" class="anchor"></a>Result type</h2><div class="odoc-spec"><div class="spec type anchored" id="type-result"><a href="#type-result" class="anchor"></a><code><span><span class="keyword">type</span> <span>('a, 'b) result</span></span><span> = </span></code><ol><li id="type-result.Ok" class="def variant constructor anchored"><a href="#type-result.Ok" class="anchor"></a><code><span>| </span><span><span class="constructor">Ok</span> <span class="keyword">of</span> <span class="type-var">'a</span></span></code></li><li id="type-result.Error" class="def variant constructor anchored"><a href="#type-result.Error" class="anchor"></a><code><span>| </span><span><span class="constructor">Error</span> <span class="keyword">of</span> <span class="type-var">'b</span></span></code></li></ol></div><div class="spec-doc"><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.03.0</li></ul></div></div><h2 id="operations-on-format-strings"><a href="#operations-on-format-strings" class="anchor"></a>Operations on format strings</h2><p>Format strings are character strings with special lexical conventions that defines the functionality of formatted input/output functions. Format strings are used to read data with formatted input functions from module <a href="Scanf/index.html"><code>Scanf</code></a> and to print data with formatted output functions from modules <a href="Printf/index.html"><code>Printf</code></a> and <a href="Format/index.html"><code>Format</code></a>.</p><p>Format strings are made of three kinds of entities:</p><ul><li><em>conversions specifications</em>, introduced by the special character <code>'%'</code> followed by one or more characters specifying what kind of argument to read or print,</li><li><em>formatting indications</em>, introduced by the special character <code>'@'</code> followed by one or more characters specifying how to read or print the argument,</li><li><em>plain characters</em> that are regular characters with usual lexical conventions. Plain characters specify string literals to be read in the input or printed in the output.</li></ul><p>There is an additional lexical rule to escape the special characters <code>'%'</code> and <code>'@'</code> in format strings: if a special character follows a <code>'%'</code> character, it is treated as a plain character. In other words, <code>&quot;%%&quot;</code> is considered as a plain <code>'%'</code> and <code>&quot;%@&quot;</code> as a plain <code>'@'</code>.</p><p>For more information about conversion specifications and formatting indications available, read the documentation of modules <a href="Scanf/index.html"><code>Scanf</code></a>, <a href="Printf/index.html"><code>Printf</code></a> and <a href="Format/index.html"><code>Format</code></a>.</p><p>Format strings have a general and highly polymorphic type <code>('a, 'b, 'c, 'd, 'e, 'f) format6</code>. The two simplified types, <code>format</code> and <code>format4</code> below are included for backward compatibility with earlier releases of OCaml.</p><p>The meaning of format string type parameters is as follows:</p><ul><li><code>'a</code> is the type of the parameters of the format for formatted output functions (<code>printf</code>-style functions); <code>'a</code> is the type of the values read by the format for formatted input functions (<code>scanf</code>-style functions).</li></ul><ul><li><code>'b</code> is the type of input source for formatted input functions and the type of output target for formatted output functions. For <code>printf</code>-style functions from module <a href="Printf/index.html"><code>Printf</code></a>, <code>'b</code> is typically <code>out_channel</code>; for <code>printf</code>-style functions from module <a href="Format/index.html"><code>Format</code></a>, <code>'b</code> is typically <a href="Format/index.html#type-formatter"><code>Format.formatter</code></a>; for <code>scanf</code>-style functions from module <a href="Scanf/index.html"><code>Scanf</code></a>, <code>'b</code> is typically <a href="Scanf/Scanning/index.html#type-in_channel"><code>Scanf.Scanning.in_channel</code></a>.</li></ul><p>Type argument <code>'b</code> is also the type of the first argument given to user's defined printing functions for <code>%a</code> and <code>%t</code> conversions, and user's defined reading functions for <code>%r</code> conversion.</p><ul><li><code>'c</code> is the type of the result of the <code>%a</code> and <code>%t</code> printing functions, and also the type of the argument transmitted to the first argument of <code>kprintf</code>-style functions or to the <code>kscanf</code>-style functions.</li></ul><ul><li><code>'d</code> is the type of parameters for the <code>scanf</code>-style functions.</li></ul><ul><li><code>'e</code> is the type of the receiver function for the <code>scanf</code>-style functions.</li></ul><ul><li><code>'f</code> is the final result type of a formatted input/output function invocation: for the <code>printf</code>-style functions, it is typically <code>unit</code>; for the <code>scanf</code>-style functions, it is typically the result type of the receiver function.</li></ul><div class="odoc-spec"><div class="spec type anchored" id="type-format6"><a href="#type-format6" class="anchor"></a><code><span><span class="keyword">type</span> <span>('a, 'b, 'c, 'd, 'e, 'f) format6</span></span><span> =
<span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'d</span>, <span class="type-var">'e</span>, <span class="type-var">'f</span>)</span> <a href="../CamlinternalFormatBasics/index.html#type-format6">CamlinternalFormatBasics.format6</a></span></span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-format4"><a href="#type-format4" class="anchor"></a><code><span><span class="keyword">type</span> <span>('a, 'b, 'c, 'd) format4</span></span><span> = <span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'c</span>, <span class="type-var">'c</span>, <span class="type-var">'d</span>)</span> <a href="#type-format6">format6</a></span></span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-format"><a href="#type-format" class="anchor"></a><code><span><span class="keyword">type</span> <span>('a, 'b, 'c) format</span></span><span> = <span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'c</span>)</span> <a href="#type-format4">format4</a></span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-string_of_format"><a href="#val-string_of_format" class="anchor"></a><code><span><span class="keyword">val</span> string_of_format : <span><span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'d</span>, <span class="type-var">'e</span>, <span class="type-var">'f</span>)</span> <a href="#type-format6">format6</a></span> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Converts a format string into a string.</p></div></div><div class="odoc-spec"><div class="spec value external anchored" id="val-format_of_string"><a href="#val-format_of_string" class="anchor"></a><code><span><span class="keyword">val</span> format_of_string :
<span><span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'d</span>, <span class="type-var">'e</span>, <span class="type-var">'f</span>)</span> <a href="#type-format6">format6</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'d</span>, <span class="type-var">'e</span>, <span class="type-var">'f</span>)</span> <a href="#type-format6">format6</a></span></span></code></div><div class="spec-doc"><p><code>format_of_string s</code> returns a format string read from the string literal <code>s</code>. Note: <code>format_of_string</code> can not convert a string argument that is not a literal. If you need this functionality, use the more general <a href="Scanf/index.html#val-format_from_string"><code>Scanf.format_from_string</code></a> function.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-(^^)"><a href="#val-(^^)" class="anchor"></a><code><span><span class="keyword">val</span> (^^) :
<span><span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'d</span>, <span class="type-var">'e</span>, <span class="type-var">'f</span>)</span> <a href="#type-format6">format6</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span class="type-var">'f</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'e</span>, <span class="type-var">'g</span>, <span class="type-var">'h</span>)</span> <a href="#type-format6">format6</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>, <span class="type-var">'c</span>, <span class="type-var">'d</span>, <span class="type-var">'g</span>, <span class="type-var">'h</span>)</span> <a href="#type-format6">format6</a></span></span></code></div><div class="spec-doc"><p><code>f1 ^^ f2</code> catenates format strings <code>f1</code> and <code>f2</code>. The result is a format string that behaves as the concatenation of format strings <code>f1</code> and <code>f2</code>: in case of formatted output, it accepts arguments from <code>f1</code>, then arguments from <code>f2</code>; in case of formatted input, it returns results from <code>f1</code>, then results from <code>f2</code>. Right-associative operator, see <code>Ocaml_operators</code> for more information.</p></div></div><h2 id="program-termination"><a href="#program-termination" class="anchor"></a>Program termination</h2><div class="odoc-spec"><div class="spec value anchored" id="val-exit"><a href="#val-exit" class="anchor"></a><code><span><span class="keyword">val</span> exit : <span>int <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Terminate the process, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. All open output channels are flushed with <code>flush_all</code>. The callbacks registered with <a href="Domain/index.html#val-at_exit"><code>Domain.at_exit</code></a> are called followed by those registered with <a href="#val-at_exit"><code>Stdlib.at_exit</code></a>.</p><p>An implicit <code>exit 0</code> is performed each time a program terminates normally. An implicit <code>exit 2</code> is performed if the program terminates early because of an uncaught exception.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-at_exit"><a href="#val-at_exit" class="anchor"></a><code><span><span class="keyword">val</span> at_exit : <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Register the given function to be called at program termination time. The functions registered with <code>at_exit</code> will be called when the program does any of the following:</p><ul><li>executes <a href="#val-exit"><code>Stdlib.exit</code></a></li><li>terminates, either normally or because of an uncaught exception</li><li>executes the C function <code>caml_shutdown</code>. The functions are called in 'last in, first out' order: the function most recently added with <code>at_exit</code> is called first.</li></ul></div></div><h2 id="modules"><a href="#modules" class="anchor"></a>Standard library modules</h2><div class="odoc-spec"><div class="spec module anchored" id="module-Arg"><a href="#module-Arg" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Arg/index.html">Arg</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Parsing of command line arguments.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Array"><a href="#module-Array" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Array/index.html">Array</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Array operations.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-ArrayLabels"><a href="#module-ArrayLabels" class="anchor"></a><code><span><span class="keyword">module</span> <a href="ArrayLabels/index.html">ArrayLabels</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Array operations.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Atomic"><a href="#module-Atomic" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Atomic/index.html">Atomic</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Atomic references.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Bigarray"><a href="#module-Bigarray" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Bigarray/index.html">Bigarray</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Large, multi-dimensional, numerical arrays.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Bool"><a href="#module-Bool" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Bool/index.html">Bool</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Boolean values.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Buffer"><a href="#module-Buffer" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Buffer/index.html">Buffer</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Extensible buffers.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Bytes"><a href="#module-Bytes" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Bytes/index.html">Bytes</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Byte sequence operations.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-BytesLabels"><a href="#module-BytesLabels" class="anchor"></a><code><span><span class="keyword">module</span> <a href="BytesLabels/index.html">BytesLabels</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Byte sequence operations.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Callback"><a href="#module-Callback" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Callback/index.html">Callback</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Registering OCaml values with the C runtime.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Char"><a href="#module-Char" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Char/index.html">Char</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Character operations.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Complex"><a href="#module-Complex" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Complex/index.html">Complex</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Complex numbers.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Condition"><a href="#module-Condition" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Condition/index.html">Condition</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Condition variables.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Digest"><a href="#module-Digest" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Digest/index.html">Digest</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>MD5 message digest.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Domain"><a href="#module-Domain" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Domain/index.html">Domain</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Effect"><a href="#module-Effect" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Effect/index.html">Effect</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Either"><a href="#module-Either" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Either/index.html">Either</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Either type.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Ephemeron"><a href="#module-Ephemeron" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Ephemeron/index.html">Ephemeron</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Ephemerons and weak hash tables.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Filename"><a href="#module-Filename" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Filename/index.html">Filename</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Operations on file names.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Float"><a href="#module-Float" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Float/index.html">Float</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Floating-point arithmetic.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Format"><a href="#module-Format" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Format/index.html">Format</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Pretty-printing.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Fun"><a href="#module-Fun" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Fun/index.html">Fun</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Function manipulation.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Gc"><a href="#module-Gc" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Gc/index.html">Gc</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Memory management control and statistics; finalised values.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Hashtbl"><a href="#module-Hashtbl" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Hashtbl/index.html">Hashtbl</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Hash tables and hash functions.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-In_channel"><a href="#module-In_channel" class="anchor"></a><code><span><span class="keyword">module</span> <a href="In_channel/index.html">In_channel</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Input channels.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Int"><a href="#module-Int" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Int/index.html">Int</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Integer values.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Int32"><a href="#module-Int32" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Int32/index.html">Int32</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>32-bit integers.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Int64"><a href="#module-Int64" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Int64/index.html">Int64</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>64-bit integers.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Lazy"><a href="#module-Lazy" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Lazy/index.html">Lazy</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Deferred computations.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Lexing"><a href="#module-Lexing" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Lexing/index.html">Lexing</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>The run-time library for lexers generated by <code>ocamllex</code>.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-List"><a href="#module-List" class="anchor"></a><code><span><span class="keyword">module</span> <a href="List/index.html">List</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>List operations.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-ListLabels"><a href="#module-ListLabels" class="anchor"></a><code><span><span class="keyword">module</span> <a href="ListLabels/index.html">ListLabels</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>List operations.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Map"><a href="#module-Map" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Map/index.html">Map</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Association tables over ordered types.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Marshal"><a href="#module-Marshal" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Marshal/index.html">Marshal</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Marshaling of data structures.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-MoreLabels"><a href="#module-MoreLabels" class="anchor"></a><code><span><span class="keyword">module</span> <a href="MoreLabels/index.html">MoreLabels</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Extra labeled libraries.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Mutex"><a href="#module-Mutex" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Mutex/index.html">Mutex</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Locks for mutual exclusion.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Nativeint"><a href="#module-Nativeint" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Nativeint/index.html">Nativeint</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Processor-native integers.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Obj"><a href="#module-Obj" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Obj/index.html">Obj</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Operations on internal representations of values.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Oo"><a href="#module-Oo" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Oo/index.html">Oo</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Operations on objects</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Option"><a href="#module-Option" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Option/index.html">Option</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Option values.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Out_channel"><a href="#module-Out_channel" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Out_channel/index.html">Out_channel</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Output channels.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Parsing"><a href="#module-Parsing" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Parsing/index.html">Parsing</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>The run-time library for parsers generated by <code>ocamlyacc</code>.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Printexc"><a href="#module-Printexc" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Printexc/index.html">Printexc</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Facilities for printing exceptions and inspecting current call stack.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Printf"><a href="#module-Printf" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Printf/index.html">Printf</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Formatted output functions.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Queue"><a href="#module-Queue" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Queue/index.html">Queue</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>First-in first-out queues.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Random"><a href="#module-Random" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Random/index.html">Random</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Pseudo-random number generators (PRNG).</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Result"><a href="#module-Result" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Result/index.html">Result</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Result values.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Scanf"><a href="#module-Scanf" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Scanf/index.html">Scanf</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Formatted input functions.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Semaphore"><a href="#module-Semaphore" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Semaphore/index.html">Semaphore</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Semaphores</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Seq"><a href="#module-Seq" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Seq/index.html">Seq</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Sequences.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Set"><a href="#module-Set" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Set/index.html">Set</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Sets over ordered types.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Stack"><a href="#module-Stack" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Stack/index.html">Stack</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Last-in first-out stacks.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-StdLabels"><a href="#module-StdLabels" class="anchor"></a><code><span><span class="keyword">module</span> <a href="StdLabels/index.html">StdLabels</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Standard labeled libraries.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-String"><a href="#module-String" class="anchor"></a><code><span><span class="keyword">module</span> <a href="String/index.html">String</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Strings.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-StringLabels"><a href="#module-StringLabels" class="anchor"></a><code><span><span class="keyword">module</span> <a href="StringLabels/index.html">StringLabels</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Strings.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Sys"><a href="#module-Sys" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Sys/index.html">Sys</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>System interface.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Uchar"><a href="#module-Uchar" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Uchar/index.html">Uchar</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Unicode characters.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Unit"><a href="#module-Unit" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Unit/index.html">Unit</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Unit values.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Weak"><a href="#module-Weak" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Weak/index.html">Weak</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Arrays of weak pointers and hash sets of weak pointers.</p></div></div></div></body></html>