Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > fb18813323b88f9a6e869238ab603257 > files > 200

ocaml-doc-4.07.1-2.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="previous" href="Parsing.html">
<link rel="next" href="Pparse.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Arg_helper" rel="Chapter" href="Arg_helper.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Ast_helper" rel="Chapter" href="Ast_helper.html">
<link title="Ast_invariants" rel="Chapter" href="Ast_invariants.html">
<link title="Ast_iterator" rel="Chapter" href="Ast_iterator.html">
<link title="Ast_mapper" rel="Chapter" href="Ast_mapper.html">
<link title="Asttypes" rel="Chapter" href="Asttypes.html">
<link title="Attr_helper" rel="Chapter" href="Attr_helper.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Build_path_prefix_map" rel="Chapter" href="Build_path_prefix_map.html">
<link title="Builtin_attributes" rel="Chapter" href="Builtin_attributes.html">
<link title="Bytes" rel="Chapter" href="Bytes.html">
<link title="BytesLabels" rel="Chapter" href="BytesLabels.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalFormat" rel="Chapter" href="CamlinternalFormat.html">
<link title="CamlinternalFormatBasics" rel="Chapter" href="CamlinternalFormatBasics.html">
<link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Ccomp" rel="Chapter" href="Ccomp.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Clflags" rel="Chapter" href="Clflags.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Config" rel="Chapter" href="Config.html">
<link title="Consistbl" rel="Chapter" href="Consistbl.html">
<link title="Depend" rel="Chapter" href="Depend.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Docstrings" rel="Chapter" href="Docstrings.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Ephemeron" rel="Chapter" href="Ephemeron.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Float" rel="Chapter" href="Float.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Graphics" rel="Chapter" href="Graphics.html">
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Identifiable" rel="Chapter" href="Identifiable.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexer" rel="Chapter" href="Lexer.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Location" rel="Chapter" href="Location.html">
<link title="Longident" rel="Chapter" href="Longident.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="Misc" rel="Chapter" href="Misc.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Numbers" rel="Chapter" href="Numbers.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Parse" rel="Chapter" href="Parse.html">
<link title="Parser" rel="Chapter" href="Parser.html">
<link title="Parsetree" rel="Chapter" href="Parsetree.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
<link title="Pparse" rel="Chapter" href="Pparse.html">
<link title="Pprintast" rel="Chapter" href="Pprintast.html">
<link title="Printast" rel="Chapter" href="Printast.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Profile" rel="Chapter" href="Profile.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Seq" rel="Chapter" href="Seq.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Simplif" rel="Chapter" href="Simplif.html">
<link title="Sort" rel="Chapter" href="Sort.html">
<link title="Spacetime" rel="Chapter" href="Spacetime.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Strongly_connected_components" rel="Chapter" href="Strongly_connected_components.html">
<link title="Syntaxerr" rel="Chapter" href="Syntaxerr.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Targetint" rel="Chapter" href="Targetint.html">
<link title="Tbl" rel="Chapter" href="Tbl.html">
<link title="Terminfo" rel="Chapter" href="Terminfo.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Typemod" rel="Chapter" href="Typemod.html">
<link title="Uchar" rel="Chapter" href="Uchar.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Warnings" rel="Chapter" href="Warnings.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Exceptions" rel="Section" href="#1_Exceptions">
<link title="Comparisons" rel="Section" href="#1_Comparisons">
<link title="Boolean operations" rel="Section" href="#1_Booleanoperations">
<link title="Debugging" rel="Section" href="#1_Debugging">
<link title="Composition operators" rel="Section" href="#1_Compositionoperators">
<link title="Integer arithmetic" rel="Section" href="#1_Integerarithmetic">
<link title="Floating-point arithmetic" rel="Section" href="#1_Floatingpointarithmetic">
<link title="String operations" rel="Section" href="#1_Stringoperations">
<link title="Character operations" rel="Section" href="#1_Characteroperations">
<link title="Unit operations" rel="Section" href="#1_Unitoperations">
<link title="String conversion functions" rel="Section" href="#1_Stringconversionfunctions">
<link title="Pair operations" rel="Section" href="#1_Pairoperations">
<link title="List operations" rel="Section" href="#1_Listoperations">
<link title="Input/output" rel="Section" href="#1_Inputoutput">
<link title="References" rel="Section" href="#1_References">
<link title="Result type" rel="Section" href="#1_Resulttype">
<link title="Operations on format strings" rel="Section" href="#1_Operationsonformatstrings">
<link title="Program termination" rel="Section" href="#1_Programtermination">
<link title="Bitwise operations" rel="Subsection" href="#2_Bitwiseoperations">
<link title="Output functions on standard output" rel="Subsection" href="#2_Outputfunctionsonstandardoutput">
<link title="Output functions on standard error" rel="Subsection" href="#2_Outputfunctionsonstandarderror">
<link title="Input functions on standard input" rel="Subsection" href="#2_Inputfunctionsonstandardinput">
<link title="General output functions" rel="Subsection" href="#2_Generaloutputfunctions">
<link title="General input functions" rel="Subsection" href="#2_Generalinputfunctions">
<link title="Operations on large files" rel="Subsection" href="#2_Operationsonlargefiles">
<title>Pervasives</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Parsing.html" title="Parsing">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Pparse.html" title="Pparse">Next</a>
</div>
<h1>Module <a href="type_Pervasives.html">Pervasives</a></h1>

<pre><span id="MODULEPervasives"><span class="keyword">module</span> Pervasives</span>: <code class="code"><span class="keyword">sig</span></code> <a href="Pervasives.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
<div class="info-desc">
<p>Pervasive operations.</p>

<p>This module provides the basic operations over the built-in types
    (numbers, booleans, byte sequences, strings, exceptions, references,
    lists, arrays, input-output channels, ...).</p>

<p>This module is included in the toplevel <code class="code"><span class="constructor">Stdlib</span></code> module.</p>
</div>
</div>
<hr width="100%">
<h2 id="1_Exceptions">Exceptions</h2>
<pre><span id="VALraise"><span class="keyword">val</span> raise</span> : <code class="type">exn -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Raise the given exception value</p>
</div>
</div>

<pre><span id="VALraise_notrace"><span class="keyword">val</span> raise_notrace</span> : <code class="type">exn -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>A faster version <code class="code">raise</code> which does not record the backtrace.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALinvalid_arg"><span class="keyword">val</span> invalid_arg</span> : <code class="type">string -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Raise exception <code class="code"><span class="constructor">Invalid_argument</span></code> with the given string.</p>
</div>
</div>

<pre><span id="VALfailwith"><span class="keyword">val</span> failwith</span> : <code class="type">string -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Raise exception <code class="code"><span class="constructor">Failure</span></code> with the given string.</p>
</div>
</div>

<pre><span id="EXCEPTIONExit"><span class="keyword">exception</span> Exit</span></pre>
<div class="info ">
<div class="info-desc">
<p>The <code class="code"><span class="constructor">Exit</span></code> exception is not raised by any library function.  It is
    provided for use in your programs.</p>
</div>
</div>
<h2 id="1_Comparisons">Comparisons</h2>
<pre><span id="VAL(=)"><span class="keyword">val</span> (=)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">e1&nbsp;=&nbsp;e2</code> tests for structural equality of <code class="code">e1</code> and <code class="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 class="code"><span class="constructor">Invalid_argument</span></code>.
   Equality between cyclic data structures may not terminate.
   Left-associative operator at precedence level 4/11.</p>
</div>
</div>

<pre><span id="VAL(<>)"><span class="keyword">val</span> (&lt;&gt;)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Negation of <a href="Pervasives.html#VAL(=)"><code class="code">(=)</code></a>.
    Left-associative operator at precedence level 4/11.</p>
</div>
</div>

<pre><span id="VAL(<)"><span class="keyword">val</span> (&lt;)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>See <a href="Pervasives.html#VAL(>=)"><code class="code">(&gt;=)</code></a>.
    Left-associative operator at precedence level 4/11.</p>
</div>
</div>

<pre><span id="VAL(>)"><span class="keyword">val</span> (&gt;)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>See <a href="Pervasives.html#VAL(>=)"><code class="code">(&gt;=)</code></a>.
    Left-associative operator at precedence level 4/11.</p>
</div>
</div>

<pre><span id="VAL(<=)"><span class="keyword">val</span> (&lt;=)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>See <a href="Pervasives.html#VAL(>=)"><code class="code">(&gt;=)</code></a>.
    Left-associative operator at precedence level 4/11.</p>
</div>
</div>

<pre><span id="VAL(>=)"><span class="keyword">val</span> (&gt;=)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<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 class="code">(&nbsp;=&nbsp;)</code>. As in the case
   of <code class="code">(&nbsp;=&nbsp;)</code>, mutable structures are compared by contents.
   Comparison between functional values raises <code class="code"><span class="constructor">Invalid_argument</span></code>.
   Comparison between cyclic structures may not terminate.
   Left-associative operator at precedence level 4/11.</p>
</div>
</div>

<pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type">'a -> 'a -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">compare&nbsp;x&nbsp;y</code> returns <code class="code">0</code> if <code class="code">x</code> is equal to <code class="code">y</code>,
   a negative integer if <code class="code">x</code> is less than <code class="code">y</code>, and a positive integer
   if <code class="code">x</code> is greater than <code class="code">y</code>.  The ordering implemented by <code class="code">compare</code>
   is compatible with the comparison predicates <code class="code">=</code>, <code class="code">&lt;</code> and <code class="code">&gt;</code>
   defined above,  with one difference on the treatment of the float value
   <a href="Pervasives.html#VALnan"><code class="code">nan</code></a>.  Namely, the comparison predicates treat <code class="code">nan</code>
   as different from any other float value, including itself;
   while <code class="code">compare</code> treats <code class="code">nan</code> as equal to itself and less than any
   other float value.  This treatment of <code class="code">nan</code> ensures that <code class="code">compare</code>
   defines a total ordering relation.</p>

<p><code class="code">compare</code> applied to functional values may raise <code class="code"><span class="constructor">Invalid_argument</span></code>.
   <code class="code">compare</code> applied to cyclic structures may not terminate.</p>

<p>The <code class="code">compare</code> function can be used as the comparison function
   required by the <a href="Set.Make.html"><code class="code"><span class="constructor">Set</span>.<span class="constructor">Make</span></code></a> and <a href="Map.Make.html"><code class="code"><span class="constructor">Map</span>.<span class="constructor">Make</span></code></a> functors, as well as
   the <a href="List.html#VALsort"><code class="code"><span class="constructor">List</span>.sort</code></a> and <a href="Array.html#VALsort"><code class="code"><span class="constructor">Array</span>.sort</code></a> functions.</p>
</div>
</div>

<pre><span id="VALmin"><span class="keyword">val</span> min</span> : <code class="type">'a -> 'a -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Return the smaller of the two arguments.
    The result is unspecified if one of the arguments contains
    the float value <code class="code">nan</code>.</p>
</div>
</div>

<pre><span id="VALmax"><span class="keyword">val</span> max</span> : <code class="type">'a -> 'a -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Return the greater of the two arguments.
    The result is unspecified if one of the arguments contains
    the float value <code class="code">nan</code>.</p>
</div>
</div>

<pre><span id="VAL(==)"><span class="keyword">val</span> (==)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">e1&nbsp;==&nbsp;e2</code> tests for physical equality of <code class="code">e1</code> and <code class="code">e2</code>.
   On mutable types such as references, arrays, byte sequences, records with
   mutable fields and objects with mutable instance variables,
   <code class="code">e1&nbsp;==&nbsp;e2</code> is true if and only if physical modification of <code class="code">e1</code>
   also affects <code class="code">e2</code>.
   On non-mutable types, the behavior of <code class="code">(&nbsp;==&nbsp;)</code> is
   implementation-dependent; however, it is guaranteed that
   <code class="code">e1&nbsp;==&nbsp;e2</code> implies <code class="code">compare&nbsp;e1&nbsp;e2&nbsp;=&nbsp;0</code>.
   Left-associative operator at precedence level 4/11.</p>
</div>
</div>

<pre><span id="VAL(!=)"><span class="keyword">val</span> (!=)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Negation of <a href="Pervasives.html#VAL(==)"><code class="code">(==)</code></a>.
    Left-associative operator at precedence level 4/11.</p>
</div>
</div>
<h2 id="1_Booleanoperations">Boolean operations</h2>
<pre><span id="VALnot"><span class="keyword">val</span> not</span> : <code class="type">bool -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>The boolean negation.</p>
</div>
</div>

<pre><span id="VAL(&&)"><span class="keyword">val</span> (&amp;&amp;)</span> : <code class="type">bool -> bool -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>The boolean 'and'. Evaluation is sequential, left-to-right:
   in <code class="code">e1&nbsp;<span class="keywordsign">&amp;&amp;</span>&nbsp;e2</code>, <code class="code">e1</code> is evaluated first, and if it returns <code class="code"><span class="keyword">false</span></code>,
   <code class="code">e2</code> is not evaluated at all.
   Right-associative operator at precedence level 3/11.</p>
</div>
</div>

<pre><span id="VAL(&)"><span class="keyword">val</span> (&amp;)</span> : <code class="type">bool -> bool -> bool</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span><a href="Pervasives.html#VAL(&&)"><code class="code">(<span class="keywordsign">&amp;&amp;</span>)</code></a> should be used instead.
    Right-associative operator at precedence level 3/11.</div>
</div>

<pre><span id="VAL(||)"><span class="keyword">val</span> (||)</span> : <code class="type">bool -> bool -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>The boolean 'or'. Evaluation is sequential, left-to-right:
   in <code class="code">e1&nbsp;<span class="keywordsign">||</span>&nbsp;e2</code>, <code class="code">e1</code> is evaluated first, and if it returns <code class="code"><span class="keyword">true</span></code>,
   <code class="code">e2</code> is not evaluated at all.
   Right-associative operator at precedence level 2/11.</p>
</div>
</div>

<pre><span id="VAL(or)"><span class="keyword">val</span> (or)</span> : <code class="type">bool -> bool -> bool</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span><a href="Pervasives.html#VAL(||)"><code class="code">(<span class="keywordsign">||</span>)</code></a> should be used instead.
    Right-associative operator at precedence level 2/11.</div>
</div>
<h2 id="1_Debugging">Debugging</h2>
<pre><span id="VAL__LOC__"><span class="keyword">val</span> __LOC__</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="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: "File %S, line %d, characters %d-%d".</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__FILE__"><span class="keyword">val</span> __FILE__</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__FILE__</code> returns the name of the file currently being
    parsed by the compiler.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__LINE__"><span class="keyword">val</span> __LINE__</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__LINE__</code> returns the line number at which this expression
    appears in the file currently being parsed by the compiler.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__MODULE__"><span class="keyword">val</span> __MODULE__</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__MODULE__</code> returns the module name of the file being
    parsed by the compiler.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__POS__"><span class="keyword">val</span> __POS__</span> : <code class="type">string * int * int * int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__POS__</code> returns a tuple <code class="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 class="code">file</code> is the current
    filename, <code class="code">lnum</code> the line number, <code class="code">cnum</code> the character position in
    the line and <code class="code">enum</code> the last character position in the line.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__LOC_OF__"><span class="keyword">val</span> __LOC_OF__</span> : <code class="type">'a -> string * 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__LOC_OF__&nbsp;expr</code> returns a pair <code class="code">(loc,&nbsp;expr)</code> where <code class="code">loc</code> is the
    location of <code class="code">expr</code> in the file currently being parsed by the
    compiler, with the standard error format of OCaml: "File %S, line
    %d, characters %d-%d".</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__LINE_OF__"><span class="keyword">val</span> __LINE_OF__</span> : <code class="type">'a -> int * 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__LINE_OF__&nbsp;expr</code> returns a pair <code class="code">(line,&nbsp;expr)</code>, where <code class="code">line</code> is the
    line number at which the expression <code class="code">expr</code> appears in the file
    currently being parsed by the compiler.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__POS_OF__"><span class="keyword">val</span> __POS_OF__</span> : <code class="type">'a -> (string * int * int * int) * 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__POS_OF__&nbsp;expr</code> returns a pair <code class="code">(loc,expr)</code>, where <code class="code">loc</code> is a
    tuple <code class="code">(file,lnum,cnum,enum)</code> corresponding to the location at
    which the expression <code class="code">expr</code> appears in the file currently being
    parsed by the compiler. <code class="code">file</code> is the current filename, <code class="code">lnum</code> the
    line number, <code class="code">cnum</code> the character position in the line and <code class="code">enum</code>
    the last character position in the line.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>
<h2 id="1_Compositionoperators">Composition operators</h2>
<pre><span id="VAL(|>)"><span class="keyword">val</span> (|&gt;)</span> : <code class="type">'a -> ('a -> 'b) -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Reverse-application operator: <code class="code">x&nbsp;|&gt;&nbsp;f&nbsp;|&gt;&nbsp;g</code> is exactly equivalent
 to <code class="code">g&nbsp;(f&nbsp;(x))</code>.
 Left-associative operator at precedence level 4/11.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01</li>
</ul>
</div>

<pre><span id="VAL(@@)"><span class="keyword">val</span> (@@)</span> : <code class="type">('a -> 'b) -> 'a -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Application operator: <code class="code">g&nbsp;@@&nbsp;f&nbsp;@@&nbsp;x</code> is exactly equivalent to
 <code class="code">g&nbsp;(f&nbsp;(x))</code>.
 Right-associative operator at precedence level 5/11.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01</li>
</ul>
</div>
<h2 id="1_Integerarithmetic">Integer arithmetic</h2><p>Integers are <code class="code"><span class="constructor">Sys</span>.int_size</code> bits wide.
    All operations are taken modulo 2<sup class="superscript"><code class="code"><span class="constructor">Sys</span>.int_size</code></sup>.
    They do not fail on overflow.</p>

<pre><span id="VAL(~-)"><span class="keyword">val</span> (~-)</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Unary negation. You can also write <code class="code">-&nbsp;e</code> instead of <code class="code"><span class="keywordsign">~-</span>&nbsp;e</code>.
    Unary operator at precedence level 9/11 for <code class="code">-&nbsp;e</code>
    and 11/11 for <code class="code"><span class="keywordsign">~-</span>&nbsp;e</code>.</p>
</div>
</div>

<pre><span id="VAL(~+)"><span class="keyword">val</span> (~+)</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Unary addition. You can also write <code class="code">+&nbsp;e</code> instead of <code class="code"><span class="keywordsign">~+</span>&nbsp;e</code>.
    Unary operator at precedence level 9/11 for <code class="code">+&nbsp;e</code>
    and 11/11 for <code class="code"><span class="keywordsign">~+</span>&nbsp;e</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALsucc"><span class="keyword">val</span> succ</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">succ&nbsp;x</code> is <code class="code">x&nbsp;+&nbsp;1</code>.</p>
</div>
</div>

<pre><span id="VALpred"><span class="keyword">val</span> pred</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pred&nbsp;x</code> is <code class="code">x&nbsp;-&nbsp;1</code>.</p>
</div>
</div>

<pre><span id="VAL(+)"><span class="keyword">val</span> (+)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer addition.
    Left-associative operator at precedence level 6/11.</p>
</div>
</div>

<pre><span id="VAL(-)"><span class="keyword">val</span> (-)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer subtraction.
    Left-associative operator at precedence level 6/11.</p>
</div>
</div>

<pre><span id="VAL( * )"><span class="keyword">val</span> ( * )</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer multiplication.
    Left-associative operator at precedence level 7/11.</p>
</div>
</div>

<pre><span id="VAL(/)"><span class="keyword">val</span> (/)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer division.
   Raise <code class="code"><span class="constructor">Division_by_zero</span></code> if the second argument is 0.
   Integer division rounds the real quotient of its arguments towards zero.
   More precisely, if <code class="code">x&nbsp;&gt;=&nbsp;0</code> and <code class="code">y&nbsp;&gt;&nbsp;0</code>, <code class="code">x&nbsp;/&nbsp;y</code> is the greatest integer
   less than or equal to the real quotient of <code class="code">x</code> by <code class="code">y</code>.  Moreover,
   <code class="code">(-&nbsp;x)&nbsp;/&nbsp;y&nbsp;=&nbsp;x&nbsp;/&nbsp;(-&nbsp;y)&nbsp;=&nbsp;-&nbsp;(x&nbsp;/&nbsp;y)</code>.
   Left-associative operator at precedence level 7/11.</p>
</div>
</div>

<pre><span id="VAL(mod)"><span class="keyword">val</span> (mod)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer remainder.  If <code class="code">y</code> is not zero, the result
   of <code class="code">x&nbsp;<span class="keyword">mod</span>&nbsp;y</code> satisfies the following properties:
   <code class="code">x&nbsp;=&nbsp;(x&nbsp;/&nbsp;y)&nbsp;*&nbsp;y&nbsp;+&nbsp;x&nbsp;<span class="keyword">mod</span>&nbsp;y</code> and
   <code class="code">abs(x&nbsp;<span class="keyword">mod</span>&nbsp;y)&nbsp;&lt;=&nbsp;abs(y)&nbsp;-&nbsp;1</code>.
   If <code class="code">y&nbsp;=&nbsp;0</code>, <code class="code">x&nbsp;<span class="keyword">mod</span>&nbsp;y</code> raises <code class="code"><span class="constructor">Division_by_zero</span></code>.
   Note that <code class="code">x&nbsp;<span class="keyword">mod</span>&nbsp;y</code> is negative only if <code class="code">x&nbsp;&lt;&nbsp;0</code>.
   Raise <code class="code"><span class="constructor">Division_by_zero</span></code> if <code class="code">y</code> is zero.
   Left-associative operator at precedence level 7/11.</p>
</div>
</div>

<pre><span id="VALabs"><span class="keyword">val</span> abs</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the absolute value of the argument.  Note that this may be
  negative if the argument is <code class="code">min_int</code>.</p>
</div>
</div>

<pre><span id="VALmax_int"><span class="keyword">val</span> max_int</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>The greatest representable integer.</p>
</div>
</div>

<pre><span id="VALmin_int"><span class="keyword">val</span> min_int</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>The smallest representable integer.</p>
</div>
</div>
<h3 id="2_Bitwiseoperations">Bitwise operations</h3>
<pre><span id="VAL(land)"><span class="keyword">val</span> (land)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Bitwise logical and.
    Left-associative operator at precedence level 7/11.</p>
</div>
</div>

<pre><span id="VAL(lor)"><span class="keyword">val</span> (lor)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Bitwise logical or.
    Left-associative operator at precedence level 7/11.</p>
</div>
</div>

<pre><span id="VAL(lxor)"><span class="keyword">val</span> (lxor)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Bitwise logical exclusive or.
    Left-associative operator at precedence level 7/11.</p>
</div>
</div>

<pre><span id="VALlnot"><span class="keyword">val</span> lnot</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Bitwise logical negation.</p>
</div>
</div>

<pre><span id="VAL(lsl)"><span class="keyword">val</span> (lsl)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">n&nbsp;<span class="keyword">lsl</span>&nbsp;m</code> shifts <code class="code">n</code> to the left by <code class="code">m</code> bits.
    The result is unspecified if <code class="code">m&nbsp;&lt;&nbsp;0</code> or <code class="code">m&nbsp;&gt;&nbsp;<span class="constructor">Sys</span>.int_size</code>.
    Right-associative operator at precedence level 8/11.</p>
</div>
</div>

<pre><span id="VAL(lsr)"><span class="keyword">val</span> (lsr)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">n&nbsp;<span class="keyword">lsr</span>&nbsp;m</code> shifts <code class="code">n</code> to the right by <code class="code">m</code> bits.
    This is a logical shift: zeroes are inserted regardless of
    the sign of <code class="code">n</code>.
    The result is unspecified if <code class="code">m&nbsp;&lt;&nbsp;0</code> or <code class="code">m&nbsp;&gt;&nbsp;<span class="constructor">Sys</span>.int_size</code>.
    Right-associative operator at precedence level 8/11.</p>
</div>
</div>

<pre><span id="VAL(asr)"><span class="keyword">val</span> (asr)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">n&nbsp;<span class="keyword">asr</span>&nbsp;m</code> shifts <code class="code">n</code> to the right by <code class="code">m</code> bits.
    This is an arithmetic shift: the sign bit of <code class="code">n</code> is replicated.
    The result is unspecified if <code class="code">m&nbsp;&lt;&nbsp;0</code> or <code class="code">m&nbsp;&gt;&nbsp;<span class="constructor">Sys</span>.int_size</code>.
    Right-associative operator at precedence level 8/11.</p>
</div>
</div>
<h2 id="1_Floatingpointarithmetic">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 class="code">infinity</code> for <code class="code">1.0&nbsp;/.&nbsp;0.0</code>,
   <code class="code">neg_infinity</code> for <code class="code">-1.0&nbsp;/.&nbsp;0.0</code>, and <code class="code">nan</code> ('not a number')
   for <code class="code">0.0&nbsp;/.&nbsp;0.0</code>.  These special numbers then propagate through
   floating-point computations as expected: for instance,
   <code class="code">1.0&nbsp;/.&nbsp;infinity</code> is <code class="code">0.0</code>, and any arithmetic operation with <code class="code">nan</code>
   as argument returns <code class="code">nan</code> as result.</p>

<pre><span id="VAL(~-.)"><span class="keyword">val</span> (~-.)</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Unary negation. You can also write <code class="code">-.&nbsp;e</code> instead of <code class="code"><span class="keywordsign">~-.</span>&nbsp;e</code>.
    Unary operator at precedence level 9/11 for <code class="code">-.&nbsp;e</code>
    and 11/11 for <code class="code"><span class="keywordsign">~-.</span>&nbsp;e</code>.</p>
</div>
</div>

<pre><span id="VAL(~+.)"><span class="keyword">val</span> (~+.)</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Unary addition. You can also write <code class="code">+.&nbsp;e</code> instead of <code class="code"><span class="keywordsign">~+.</span>&nbsp;e</code>.
    Unary operator at precedence level 9/11 for <code class="code">+.&nbsp;e</code>
    and 11/11 for <code class="code"><span class="keywordsign">~+.</span>&nbsp;e</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VAL(+.)"><span class="keyword">val</span> (+.)</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Floating-point addition.
    Left-associative operator at precedence level 6/11.</p>
</div>
</div>

<pre><span id="VAL(-.)"><span class="keyword">val</span> (-.)</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Floating-point subtraction.
    Left-associative operator at precedence level 6/11.</p>
</div>
</div>

<pre><span id="VAL( *. )"><span class="keyword">val</span> ( *. )</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Floating-point multiplication.
    Left-associative operator at precedence level 7/11.</p>
</div>
</div>

<pre><span id="VAL(/.)"><span class="keyword">val</span> (/.)</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Floating-point division.
    Left-associative operator at precedence level 7/11.</p>
</div>
</div>

<pre><span id="VAL( ** )"><span class="keyword">val</span> ( ** )</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Exponentiation.
    Right-associative operator at precedence level 8/11.</p>
</div>
</div>

<pre><span id="VALsqrt"><span class="keyword">val</span> sqrt</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Square root.</p>
</div>
</div>

<pre><span id="VALexp"><span class="keyword">val</span> exp</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Exponential.</p>
</div>
</div>

<pre><span id="VALlog"><span class="keyword">val</span> log</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Natural logarithm.</p>
</div>
</div>

<pre><span id="VALlog10"><span class="keyword">val</span> log10</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Base 10 logarithm.</p>
</div>
</div>

<pre><span id="VALexpm1"><span class="keyword">val</span> expm1</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">expm1&nbsp;x</code> computes <code class="code">exp&nbsp;x&nbsp;-.&nbsp;1.0</code>, giving numerically-accurate results
    even if <code class="code">x</code> is close to <code class="code">0.0</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALlog1p"><span class="keyword">val</span> log1p</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">log1p&nbsp;x</code> computes <code class="code">log(1.0&nbsp;+.&nbsp;x)</code> (natural logarithm),
    giving numerically-accurate results even if <code class="code">x</code> is close to <code class="code">0.0</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALcos"><span class="keyword">val</span> cos</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Cosine.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALsin"><span class="keyword">val</span> sin</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Sine.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALtan"><span class="keyword">val</span> tan</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Tangent.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALacos"><span class="keyword">val</span> acos</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Arc cosine.  The argument must fall within the range <code class="code">[-1.0,&nbsp;1.0]</code>.
    Result is in radians and is between <code class="code">0.0</code> and <code class="code">pi</code>.</p>
</div>
</div>

<pre><span id="VALasin"><span class="keyword">val</span> asin</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Arc sine.  The argument must fall within the range <code class="code">[-1.0,&nbsp;1.0]</code>.
    Result is in radians and is between <code class="code">-pi/2</code> and <code class="code">pi/2</code>.</p>
</div>
</div>

<pre><span id="VALatan"><span class="keyword">val</span> atan</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Arc tangent.
    Result is in radians and is between <code class="code">-pi/2</code> and <code class="code">pi/2</code>.</p>
</div>
</div>

<pre><span id="VALatan2"><span class="keyword">val</span> atan2</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">atan2&nbsp;y&nbsp;x</code> returns the arc tangent of <code class="code">y&nbsp;/.&nbsp;x</code>.  The signs of <code class="code">x</code>
    and <code class="code">y</code> are used to determine the quadrant of the result.
    Result is in radians and is between <code class="code">-pi</code> and <code class="code">pi</code>.</p>
</div>
</div>

<pre><span id="VALhypot"><span class="keyword">val</span> hypot</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">hypot&nbsp;x&nbsp;y</code> returns <code class="code">sqrt(x&nbsp;*.&nbsp;x&nbsp;+&nbsp;y&nbsp;*.&nbsp;y)</code>, that is, the length
  of the hypotenuse of a right-angled triangle with sides of length
  <code class="code">x</code> and <code class="code">y</code>, or, equivalently, the distance of the point <code class="code">(x,y)</code>
  to origin.  If one of <code class="code">x</code> or <code class="code">y</code> is infinite, returns <code class="code">infinity</code>
  even if the other is <code class="code">nan</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.00.0</li>
</ul>
</div>

<pre><span id="VALcosh"><span class="keyword">val</span> cosh</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Hyperbolic cosine.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALsinh"><span class="keyword">val</span> sinh</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Hyperbolic sine.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALtanh"><span class="keyword">val</span> tanh</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Hyperbolic tangent.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALceil"><span class="keyword">val</span> ceil</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Round above to an integer value.
    <code class="code">ceil&nbsp;f</code> returns the least integer value greater than or equal to <code class="code">f</code>.
    The result is returned as a float.</p>
</div>
</div>

<pre><span id="VALfloor"><span class="keyword">val</span> floor</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Round below to an integer value.
    <code class="code">floor&nbsp;f</code> returns the greatest integer value less than or
    equal to <code class="code">f</code>.
    The result is returned as a float.</p>
</div>
</div>

<pre><span id="VALabs_float"><span class="keyword">val</span> abs_float</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">abs_float&nbsp;f</code> returns the absolute value of <code class="code">f</code>.</p>
</div>
</div>

<pre><span id="VALcopysign"><span class="keyword">val</span> copysign</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">copysign&nbsp;x&nbsp;y</code> returns a float whose absolute value is that of <code class="code">x</code>
  and whose sign is that of <code class="code">y</code>.  If <code class="code">x</code> is <code class="code">nan</code>, returns <code class="code">nan</code>.
  If <code class="code">y</code> is <code class="code">nan</code>, returns either <code class="code">x</code> or <code class="code">-.&nbsp;x</code>, but it is not
  specified which.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.00.0</li>
</ul>
</div>

<pre><span id="VALmod_float"><span class="keyword">val</span> mod_float</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">mod_float&nbsp;a&nbsp;b</code> returns the remainder of <code class="code">a</code> with respect to
   <code class="code">b</code>.  The returned value is <code class="code">a&nbsp;-.&nbsp;n&nbsp;*.&nbsp;b</code>, where <code class="code">n</code>
   is the quotient <code class="code">a&nbsp;/.&nbsp;b</code> rounded towards zero to an integer.</p>
</div>
</div>

<pre><span id="VALfrexp"><span class="keyword">val</span> frexp</span> : <code class="type">float -> float * int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">frexp&nbsp;f</code> returns the pair of the significant
   and the exponent of <code class="code">f</code>.  When <code class="code">f</code> is zero, the
   significant <code class="code">x</code> and the exponent <code class="code">n</code> of <code class="code">f</code> are equal to
   zero.  When <code class="code">f</code> is non-zero, they are defined by
   <code class="code">f&nbsp;=&nbsp;x&nbsp;*.&nbsp;2&nbsp;**&nbsp;n</code> and <code class="code">0.5&nbsp;&lt;=&nbsp;x&nbsp;&lt;&nbsp;1.0</code>.</p>
</div>
</div>

<pre><span id="VALldexp"><span class="keyword">val</span> ldexp</span> : <code class="type">float -> int -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">ldexp&nbsp;x&nbsp;n</code> returns <code class="code">x&nbsp;*.&nbsp;2&nbsp;**&nbsp;n</code>.</p>
</div>
</div>

<pre><span id="VALmodf"><span class="keyword">val</span> modf</span> : <code class="type">float -> float * float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">modf&nbsp;f</code> returns the pair of the fractional and integral
   part of <code class="code">f</code>.</p>
</div>
</div>

<pre><span id="VALfloat"><span class="keyword">val</span> float</span> : <code class="type">int -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Pervasives.html#VALfloat_of_int"><code class="code">float_of_int</code></a>.</p>
</div>
</div>

<pre><span id="VALfloat_of_int"><span class="keyword">val</span> float_of_int</span> : <code class="type">int -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Convert an integer to floating-point.</p>
</div>
</div>

<pre><span id="VALtruncate"><span class="keyword">val</span> truncate</span> : <code class="type">float -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Pervasives.html#VALint_of_float"><code class="code">int_of_float</code></a>.</p>
</div>
</div>

<pre><span id="VALint_of_float"><span class="keyword">val</span> int_of_float</span> : <code class="type">float -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Truncate the given floating-point number to an integer.
   The result is unspecified if the argument is <code class="code">nan</code> or falls outside the
   range of representable integers.</p>
</div>
</div>

<pre><span id="VALinfinity"><span class="keyword">val</span> infinity</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>Positive infinity.</p>
</div>
</div>

<pre><span id="VALneg_infinity"><span class="keyword">val</span> neg_infinity</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>Negative infinity.</p>
</div>
</div>

<pre><span id="VALnan"><span class="keyword">val</span> nan</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>A special floating-point value denoting the result of an
   undefined operation such as <code class="code">0.0&nbsp;/.&nbsp;0.0</code>.  Stands for
   'not a number'.  Any floating-point operation with <code class="code">nan</code> as
   argument returns <code class="code">nan</code> as result.  As for floating-point comparisons,
   <code class="code">=</code>, <code class="code">&lt;</code>, <code class="code">&lt;=</code>, <code class="code">&gt;</code> and <code class="code">&gt;=</code> return <code class="code"><span class="keyword">false</span></code> and <code class="code">&lt;&gt;</code> returns <code class="code"><span class="keyword">true</span></code>
   if one or both of their arguments is <code class="code">nan</code>.</p>
</div>
</div>

<pre><span id="VALmax_float"><span class="keyword">val</span> max_float</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>The largest positive finite value of type <code class="code">float</code>.</p>
</div>
</div>

<pre><span id="VALmin_float"><span class="keyword">val</span> min_float</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>The smallest positive, non-zero, non-denormalized value of type <code class="code">float</code>.</p>
</div>
</div>

<pre><span id="VALepsilon_float"><span class="keyword">val</span> epsilon_float</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>The difference between <code class="code">1.0</code> and the smallest exactly representable
    floating-point number greater than <code class="code">1.0</code>.</p>
</div>
</div>

<pre><code><span id="TYPEfpclass"><span class="keyword">type</span> <code class="type"></code>fpclass</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_normal"><span class="constructor">FP_normal</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Normal number, none of the below</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_subnormal"><span class="constructor">FP_subnormal</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Number very close to 0.0, has reduced precision</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_zero"><span class="constructor">FP_zero</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Number is 0.0 or -0.0</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_infinite"><span class="constructor">FP_infinite</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Number is positive or negative infinity</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_nan"><span class="constructor">FP_nan</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Not a number: result of an undefined operation</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>The five classes of floating-point numbers, as determined by
   the <a href="Pervasives.html#VALclassify_float"><code class="code">classify_float</code></a> function.</p>
</div>
</div>


<pre><span id="VALclassify_float"><span class="keyword">val</span> classify_float</span> : <code class="type">float -> <a href="Pervasives.html#TYPEfpclass">fpclass</a></code></pre><div class="info ">
<div class="info-desc">
<p>Return the class of the given floating-point number:
   normal, subnormal, zero, infinite, or not a number.</p>
</div>
</div>
<h2 id="1_Stringoperations">String operations</h2>
<p>More string operations are provided in module <a href="String.html"><code class="code"><span class="constructor">String</span></code></a>.</p>

<pre><span id="VAL(^)"><span class="keyword">val</span> (^)</span> : <code class="type">string -> string -> string</code></pre><div class="info ">
<div class="info-desc">
<p>String concatenation.
    Right-associative operator at precedence level 5/11.</p>
</div>
</div>
<h2 id="1_Characteroperations">Character operations</h2>
<p>More character operations are provided in module <a href="Char.html"><code class="code"><span class="constructor">Char</span></code></a>.</p>

<pre><span id="VALint_of_char"><span class="keyword">val</span> int_of_char</span> : <code class="type">char -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the ASCII code of the argument.</p>
</div>
</div>

<pre><span id="VALchar_of_int"><span class="keyword">val</span> char_of_int</span> : <code class="type">int -> char</code></pre><div class="info ">
<div class="info-desc">
<p>Return the character with the given ASCII code.
   Raise <code class="code"><span class="constructor">Invalid_argument</span>&nbsp;<span class="string">"char_of_int"</span></code> if the argument is
   outside the range 0--255.</p>
</div>
</div>
<h2 id="1_Unitoperations">Unit operations</h2>
<pre><span id="VALignore"><span class="keyword">val</span> ignore</span> : <code class="type">'a -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Discard the value of its argument and return <code class="code">()</code>.
   For instance, <code class="code">ignore(f&nbsp;x)</code> discards the result of
   the side-effecting function <code class="code">f</code>.  It is equivalent to
   <code class="code">f&nbsp;x;&nbsp;()</code>, except that the latter may generate a
   compiler warning; writing <code class="code">ignore(f&nbsp;x)</code> instead
   avoids the warning.</p>
</div>
</div>
<h2 id="1_Stringconversionfunctions">String conversion functions</h2>
<pre><span id="VALstring_of_bool"><span class="keyword">val</span> string_of_bool</span> : <code class="type">bool -> string</code></pre><div class="info ">
<div class="info-desc">
<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>

<pre><span id="VALbool_of_string"><span class="keyword">val</span> bool_of_string</span> : <code class="type">string -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Convert the given string to a boolean.
   Raise <code class="code"><span class="constructor">Invalid_argument</span>&nbsp;<span class="string">"bool_of_string"</span></code> if the string is not
   <code class="code"><span class="string">"true"</span></code> or <code class="code"><span class="string">"false"</span></code>.</p>
</div>
</div>

<pre><span id="VALbool_of_string_opt"><span class="keyword">val</span> bool_of_string_opt</span> : <code class="type">string -> bool option</code></pre><div class="info ">
<div class="info-desc">
<p>Convert the given string to a boolean.
    Return <code class="code"><span class="constructor">None</span></code> if the string is not
    <code class="code"><span class="string">"true"</span></code> or <code class="code"><span class="string">"false"</span></code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALstring_of_int"><span class="keyword">val</span> string_of_int</span> : <code class="type">int -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the string representation of an integer, in decimal.</p>
</div>
</div>

<pre><span id="VALint_of_string"><span class="keyword">val</span> int_of_string</span> : <code class="type">string -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Convert the given string to an integer.
   The string is read in decimal (by default, or if the string
   begins with <code class="code">0u</code>), in hexadecimal (if it begins with <code class="code">0x</code> or
   <code class="code">0<span class="constructor">X</span></code>), in octal (if it begins with <code class="code">0o</code> or <code class="code">0<span class="constructor">O</span></code>), or in binary
   (if it begins with <code class="code">0b</code> or <code class="code">0<span class="constructor">B</span></code>).</p>

<p>The <code class="code">0u</code> prefix reads the input as an unsigned integer in the range
   <code class="code">[0,&nbsp;2*max_int+1]</code>.  If the input exceeds <a href="Pervasives.html#VALmax_int"><code class="code">max_int</code></a>
   it is converted to the signed integer
   <code class="code">min_int&nbsp;+&nbsp;input&nbsp;-&nbsp;max_int&nbsp;-&nbsp;1</code>.</p>

<p>The <code class="code">_</code> (underscore) character can appear anywhere in the string
   and is ignored.
   Raise <code class="code"><span class="constructor">Failure</span>&nbsp;<span class="string">"int_of_string"</span></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 class="code">int</code>.</p>
</div>
</div>

<pre><span id="VALint_of_string_opt"><span class="keyword">val</span> int_of_string_opt</span> : <code class="type">string -> int option</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">int_of_string</code>, but returns <code class="code"><span class="constructor">None</span></code> instead of raising.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALstring_of_float"><span class="keyword">val</span> string_of_float</span> : <code class="type">float -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the string representation of a floating-point number.</p>
</div>
</div>

<pre><span id="VALfloat_of_string"><span class="keyword">val</span> float_of_string</span> : <code class="type">string -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Convert the given string to a float.  The string is read in decimal
   (by default) or in hexadecimal (marked by <code class="code">0x</code> or <code class="code">0<span class="constructor">X</span></code>).
   The format of decimal floating-point numbers is
   <code class="code">&nbsp;[-]&nbsp;dd.ddd&nbsp;(e<span class="keywordsign">|</span><span class="constructor">E</span>)&nbsp;[+|-]&nbsp;dd&nbsp;</code>, where <code class="code">d</code> stands for a decimal digit.
   The format of hexadecimal floating-point numbers is
   <code class="code">&nbsp;[-]&nbsp;0(x<span class="keywordsign">|</span><span class="constructor">X</span>)&nbsp;hh.hhh&nbsp;(p<span class="keywordsign">|</span><span class="constructor">P</span>)&nbsp;[+|-]&nbsp;dd&nbsp;</code>, where <code class="code">h</code> stands for an
   hexadecimal digit and <code class="code">d</code> for a decimal digit.
   In both cases, at least one of the integer and fractional parts must be
   given; the exponent part is optional.
   The <code class="code">_</code> (underscore) character can appear anywhere in the string
   and is ignored.
   Depending on the execution platforms, other representations of
   floating-point numbers can be accepted, but should not be relied upon.
   Raise <code class="code"><span class="constructor">Failure</span>&nbsp;<span class="string">"float_of_string"</span></code> if the given string is not a valid
   representation of a float.</p>
</div>
</div>

<pre><span id="VALfloat_of_string_opt"><span class="keyword">val</span> float_of_string_opt</span> : <code class="type">string -> float option</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">float_of_string</code>, but returns <code class="code"><span class="constructor">None</span></code> instead of raising.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>
<h2 id="1_Pairoperations">Pair operations</h2>
<pre><span id="VALfst"><span class="keyword">val</span> fst</span> : <code class="type">'a * 'b -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Return the first component of a pair.</p>
</div>
</div>

<pre><span id="VALsnd"><span class="keyword">val</span> snd</span> : <code class="type">'a * 'b -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Return the second component of a pair.</p>
</div>
</div>
<h2 id="1_Listoperations">List operations</h2>
<p>More list operations are provided in module <a href="List.html"><code class="code"><span class="constructor">List</span></code></a>.</p>

<pre><span id="VAL(@)"><span class="keyword">val</span> (@)</span> : <code class="type">'a list -> 'a list -> 'a list</code></pre><div class="info ">
<div class="info-desc">
<p>List concatenation.  Not tail-recursive (length of the first argument).
    Right-associative operator at precedence level 5/11.</p>
</div>
</div>
<h2 id="1_Inputoutput">Input/output</h2><p>Note: all input/output functions can raise <code class="code"><span class="constructor">Sys_error</span></code> when the system
    calls they invoke fail.</p>

<pre><span id="TYPEin_channel"><span class="keyword">type</span> <code class="type"></code>in_channel</span> </pre>
<div class="info ">
<div class="info-desc">
<p>The type of input channel.</p>
</div>
</div>


<pre><span id="TYPEout_channel"><span class="keyword">type</span> <code class="type"></code>out_channel</span> </pre>
<div class="info ">
<div class="info-desc">
<p>The type of output channel.</p>
</div>
</div>


<pre><span id="VALstdin"><span class="keyword">val</span> stdin</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>The standard input for the process.</p>
</div>
</div>

<pre><span id="VALstdout"><span class="keyword">val</span> stdout</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>The standard output for the process.</p>
</div>
</div>

<pre><span id="VALstderr"><span class="keyword">val</span> stderr</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>The standard error output for the process.</p>
</div>
</div>
<h3 id="2_Outputfunctionsonstandardoutput">Output functions on standard output</h3>
<pre><span id="VALprint_char"><span class="keyword">val</span> print_char</span> : <code class="type">char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a character on standard output.</p>
</div>
</div>

<pre><span id="VALprint_string"><span class="keyword">val</span> print_string</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a string on standard output.</p>
</div>
</div>

<pre><span id="VALprint_bytes"><span class="keyword">val</span> print_bytes</span> : <code class="type">bytes -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a byte sequence on standard output.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALprint_int"><span class="keyword">val</span> print_int</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print an integer, in decimal, on standard output.</p>
</div>
</div>

<pre><span id="VALprint_float"><span class="keyword">val</span> print_float</span> : <code class="type">float -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a floating-point number, in decimal, on standard output.</p>
</div>
</div>

<pre><span id="VALprint_endline"><span class="keyword">val</span> print_endline</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a string, followed by a newline character, on
   standard output and flush standard output.</p>
</div>
</div>

<pre><span id="VALprint_newline"><span class="keyword">val</span> print_newline</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<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="2_Outputfunctionsonstandarderror">Output functions on standard error</h3>
<pre><span id="VALprerr_char"><span class="keyword">val</span> prerr_char</span> : <code class="type">char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a character on standard error.</p>
</div>
</div>

<pre><span id="VALprerr_string"><span class="keyword">val</span> prerr_string</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a string on standard error.</p>
</div>
</div>

<pre><span id="VALprerr_bytes"><span class="keyword">val</span> prerr_bytes</span> : <code class="type">bytes -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a byte sequence on standard error.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALprerr_int"><span class="keyword">val</span> prerr_int</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print an integer, in decimal, on standard error.</p>
</div>
</div>

<pre><span id="VALprerr_float"><span class="keyword">val</span> prerr_float</span> : <code class="type">float -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a floating-point number, in decimal, on standard error.</p>
</div>
</div>

<pre><span id="VALprerr_endline"><span class="keyword">val</span> prerr_endline</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a string, followed by a newline character on standard
   error and flush standard error.</p>
</div>
</div>

<pre><span id="VALprerr_newline"><span class="keyword">val</span> prerr_newline</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a newline character on standard error, and flush
   standard error.</p>
</div>
</div>
<h3 id="2_Inputfunctionsonstandardinput">Input functions on standard input</h3>
<pre><span id="VALread_line"><span class="keyword">val</span> read_line</span> : <code class="type">unit -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Flush standard output, then read characters from standard input
   until a newline character is encountered. Return the string of
   all characters read, without the newline character at the end.</p>
</div>
</div>

<pre><span id="VALread_int"><span class="keyword">val</span> read_int</span> : <code class="type">unit -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Flush standard output, then read one line from standard input
   and convert it to an integer. Raise <code class="code"><span class="constructor">Failure</span>&nbsp;<span class="string">"int_of_string"</span></code>
   if the line read is not a valid representation of an integer.</p>
</div>
</div>

<pre><span id="VALread_int_opt"><span class="keyword">val</span> read_int_opt</span> : <code class="type">unit -> int option</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">read_int_opt</code>, but returns <code class="code"><span class="constructor">None</span></code> instead of raising.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALread_float"><span class="keyword">val</span> read_float</span> : <code class="type">unit -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Flush standard output, then read one line from standard input
   and convert it to a floating-point number.
   The result is unspecified if the line read is not a valid
   representation of a floating-point number.</p>
</div>
</div>

<pre><span id="VALread_float_opt"><span class="keyword">val</span> read_float_opt</span> : <code class="type">unit -> float option</code></pre><div class="info ">
<div class="info-desc">
<p>Flush standard output, then read one line from standard input
    and convert it to a floating-point number.
    Returns <code class="code"><span class="constructor">None</span></code> if the line read is not a valid
    representation of a floating-point number.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05.0</li>
</ul>
</div>
<h3 id="2_Generaloutputfunctions">General output functions</h3>
<pre><code><span id="TYPEopen_flag"><span class="keyword">type</span> <code class="type"></code>open_flag</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_rdonly"><span class="constructor">Open_rdonly</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open for reading.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_wronly"><span class="constructor">Open_wronly</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open for writing.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_append"><span class="constructor">Open_append</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open for appending: always write at end of file.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_creat"><span class="constructor">Open_creat</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>create the file if it does not exist.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_trunc"><span class="constructor">Open_trunc</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>empty the file if it already exists.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_excl"><span class="constructor">Open_excl</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>fail if Open_creat and the file already exists.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_binary"><span class="constructor">Open_binary</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open in binary mode (no conversion).</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_text"><span class="constructor">Open_text</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open in text mode (may perform conversions).</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_nonblock"><span class="constructor">Open_nonblock</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open in non-blocking mode.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>Opening modes for <a href="Pervasives.html#VALopen_out_gen"><code class="code">open_out_gen</code></a> and
  <a href="Pervasives.html#VALopen_in_gen"><code class="code">open_in_gen</code></a>.</p>
</div>
</div>


<pre><span id="VALopen_out"><span class="keyword">val</span> open_out</span> : <code class="type">string -> <a href="Pervasives.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<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>

<pre><span id="VALopen_out_bin"><span class="keyword">val</span> open_out_bin</span> : <code class="type">string -> <a href="Pervasives.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Pervasives.html#VALopen_out"><code class="code">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="Pervasives.html#VALopen_out"><code class="code">open_out</code></a>.</p>
</div>
</div>

<pre><span id="VALopen_out_gen"><span class="keyword">val</span> open_out_gen</span> : <code class="type"><a href="Pervasives.html#TYPEopen_flag">open_flag</a> list -> int -> string -> <a href="Pervasives.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">open_out_gen&nbsp;mode&nbsp;perm&nbsp;filename</code> opens the named file for writing,
   as described above. The extra argument <code class="code">mode</code>
   specifies the opening mode. The extra argument <code class="code">perm</code> specifies
   the file permissions, in case the file must be created.
   <a href="Pervasives.html#VALopen_out"><code class="code">open_out</code></a> and <a href="Pervasives.html#VALopen_out_bin"><code class="code">open_out_bin</code></a> are special
   cases of this function.</p>
</div>
</div>

<pre><span id="VALflush"><span class="keyword">val</span> flush</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<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>

<pre><span id="VALflush_all"><span class="keyword">val</span> flush_all</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Flush all open output channels; ignore errors.</p>
</div>
</div>

<pre><span id="VALoutput_char"><span class="keyword">val</span> output_char</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write the character on the given output channel.</p>
</div>
</div>

<pre><span id="VALoutput_string"><span class="keyword">val</span> output_string</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write the string on the given output channel.</p>
</div>
</div>

<pre><span id="VALoutput_bytes"><span class="keyword">val</span> output_bytes</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> bytes -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write the byte sequence on the given output channel.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALoutput"><span class="keyword">val</span> output</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">output&nbsp;oc&nbsp;buf&nbsp;pos&nbsp;len</code> writes <code class="code">len</code> characters from byte sequence <code class="code">buf</code>,
   starting at offset <code class="code">pos</code>, to the given output channel <code class="code">oc</code>.
   Raise <code class="code"><span class="constructor">Invalid_argument</span>&nbsp;<span class="string">"output"</span></code> if <code class="code">pos</code> and <code class="code">len</code> do not
   designate a valid range of <code class="code">buf</code>.</p>
</div>
</div>

<pre><span id="VALoutput_substring"><span class="keyword">val</span> output_substring</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> string -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">output</code> but take a string as argument instead of
   a byte sequence.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALoutput_byte"><span class="keyword">val</span> output_byte</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<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>

<pre><span id="VALoutput_binary_int"><span class="keyword">val</span> output_binary_int</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write one integer in binary format (4 bytes, big-endian)
   on the given output channel.
   The given integer is taken modulo 2<sup class="superscript">32</sup>.
   The only reliable way to read it back is through the
   <a href="Pervasives.html#VALinput_binary_int"><code class="code">input_binary_int</code></a> function. The format is compatible across
   all machines for a given version of OCaml.</p>
</div>
</div>

<pre><span id="VALoutput_value"><span class="keyword">val</span> output_value</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> 'a -> unit</code></pre><div class="info ">
<div class="info-desc">
<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="Pervasives.html#VALinput_value"><code class="code">input_value</code></a>. See the description of module
   <a href="Marshal.html"><code class="code"><span class="constructor">Marshal</span></code></a> for more information. <a href="Pervasives.html#VALoutput_value"><code class="code">output_value</code></a> is equivalent
   to <a href="Marshal.html#VALto_channel"><code class="code"><span class="constructor">Marshal</span>.to_channel</code></a> with an empty list of flags.</p>
</div>
</div>

<pre><span id="VALseek_out"><span class="keyword">val</span> seek_out</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">seek_out&nbsp;chan&nbsp;pos</code> sets the current writing position to <code class="code">pos</code>
   for channel <code class="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>

<pre><span id="VALpos_out"><span class="keyword">val</span> pos_out</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the current writing position for the given channel.  Does
    not work on channels opened with the <code class="code"><span class="constructor">Open_append</span></code> flag (returns
    unspecified results).</p>
</div>
</div>

<pre><span id="VALout_channel_length"><span class="keyword">val</span> out_channel_length</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<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>

<pre><span id="VALclose_out"><span class="keyword">val</span> close_out</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Close the given channel, flushing all buffered write operations.
   Output functions raise a <code class="code"><span class="constructor">Sys_error</span></code> exception when they are
   applied to a closed output channel, except <code class="code">close_out</code> and <code class="code">flush</code>,
   which do nothing when applied to an already closed channel.
   Note that <code class="code">close_out</code> may raise <code class="code"><span class="constructor">Sys_error</span></code> if the operating
   system signals an error when flushing or closing.</p>
</div>
</div>

<pre><span id="VALclose_out_noerr"><span class="keyword">val</span> close_out_noerr</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">close_out</code>, but ignore all errors.</p>
</div>
</div>

<pre><span id="VALset_binary_mode_out"><span class="keyword">val</span> set_binary_mode_out</span> : <code class="type"><a href="Pervasives.html#TYPEout_channel">out_channel</a> -> bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_binary_mode_out&nbsp;oc&nbsp;<span class="keyword">true</span></code> sets the channel <code class="code">oc</code> to binary
   mode: no translations take place during output.
   <code class="code">set_binary_mode_out&nbsp;oc&nbsp;<span class="keyword">false</span></code> sets the channel <code class="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 class="code">\n</code> to <code class="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="2_Generalinputfunctions">General input functions</h3>
<pre><span id="VALopen_in"><span class="keyword">val</span> open_in</span> : <code class="type">string -> <a href="Pervasives.html#TYPEin_channel">in_channel</a></code></pre><div class="info ">
<div class="info-desc">
<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>

<pre><span id="VALopen_in_bin"><span class="keyword">val</span> open_in_bin</span> : <code class="type">string -> <a href="Pervasives.html#TYPEin_channel">in_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Pervasives.html#VALopen_in"><code class="code">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="Pervasives.html#VALopen_in"><code class="code">open_in</code></a>.</p>
</div>
</div>

<pre><span id="VALopen_in_gen"><span class="keyword">val</span> open_in_gen</span> : <code class="type"><a href="Pervasives.html#TYPEopen_flag">open_flag</a> list -> int -> string -> <a href="Pervasives.html#TYPEin_channel">in_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">open_in_gen&nbsp;mode&nbsp;perm&nbsp;filename</code> opens the named file for reading,
   as described above. The extra arguments
   <code class="code">mode</code> and <code class="code">perm</code> specify the opening mode and file permissions.
   <a href="Pervasives.html#VALopen_in"><code class="code">open_in</code></a> and <a href="Pervasives.html#VALopen_in_bin"><code class="code">open_in_bin</code></a> are special
   cases of this function.</p>
</div>
</div>

<pre><span id="VALinput_char"><span class="keyword">val</span> input_char</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> char</code></pre><div class="info ">
<div class="info-desc">
<p>Read one character from the given input channel.
   Raise <code class="code"><span class="constructor">End_of_file</span></code> if there are no more characters to read.</p>
</div>
</div>

<pre><span id="VALinput_line"><span class="keyword">val</span> input_line</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<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.
   Raise <code class="code"><span class="constructor">End_of_file</span></code> if the end of the file is reached
   at the beginning of line.</p>
</div>
</div>

<pre><span id="VALinput"><span class="keyword">val</span> input</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> bytes -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">input&nbsp;ic&nbsp;buf&nbsp;pos&nbsp;len</code> reads up to <code class="code">len</code> characters from
   the given channel <code class="code">ic</code>, storing them in byte sequence <code class="code">buf</code>, starting at
   character number <code class="code">pos</code>.
   It returns the actual number of characters read, between 0 and
   <code class="code">len</code> (inclusive).
   A return value of 0 means that the end of file was reached.
   A return value between 0 and <code class="code">len</code> exclusive means that
   not all requested <code class="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 class="code">input</code> must be called again to read the remaining characters,
   if desired.  (See also <a href="Pervasives.html#VALreally_input"><code class="code">really_input</code></a> for reading
   exactly <code class="code">len</code> characters.)
   Exception <code class="code"><span class="constructor">Invalid_argument</span>&nbsp;<span class="string">"input"</span></code> is raised if <code class="code">pos</code> and <code class="code">len</code>
   do not designate a valid range of <code class="code">buf</code>.</p>
</div>
</div>

<pre><span id="VALreally_input"><span class="keyword">val</span> really_input</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">really_input&nbsp;ic&nbsp;buf&nbsp;pos&nbsp;len</code> reads <code class="code">len</code> characters from channel <code class="code">ic</code>,
   storing them in byte sequence <code class="code">buf</code>, starting at character number <code class="code">pos</code>.
   Raise <code class="code"><span class="constructor">End_of_file</span></code> if the end of file is reached before <code class="code">len</code>
   characters have been read.
   Raise <code class="code"><span class="constructor">Invalid_argument</span>&nbsp;<span class="string">"really_input"</span></code> if
   <code class="code">pos</code> and <code class="code">len</code> do not designate a valid range of <code class="code">buf</code>.</p>
</div>
</div>

<pre><span id="VALreally_input_string"><span class="keyword">val</span> really_input_string</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> int -> string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">really_input_string&nbsp;ic&nbsp;len</code> reads <code class="code">len</code> characters from channel <code class="code">ic</code>
   and returns them in a new string.
   Raise <code class="code"><span class="constructor">End_of_file</span></code> if the end of file is reached before <code class="code">len</code>
   characters have been read.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALinput_byte"><span class="keyword">val</span> input_byte</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Pervasives.html#VALinput_char"><code class="code">input_char</code></a>, but return the 8-bit integer representing
   the character.
   Raise <code class="code"><span class="constructor">End_of_file</span></code> if an end of file was reached.</p>
</div>
</div>

<pre><span id="VALinput_binary_int"><span class="keyword">val</span> input_binary_int</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Read an integer encoded in binary format (4 bytes, big-endian)
   from the given input channel. See <a href="Pervasives.html#VALoutput_binary_int"><code class="code">output_binary_int</code></a>.
   Raise <code class="code"><span class="constructor">End_of_file</span></code> if an end of file was reached while reading the
   integer.</p>
</div>
</div>

<pre><span id="VALinput_value"><span class="keyword">val</span> input_value</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Read the representation of a structured value, as produced
   by <a href="Pervasives.html#VALoutput_value"><code class="code">output_value</code></a>, and return the corresponding value.
   This function is identical to <a href="Marshal.html#VALfrom_channel"><code class="code"><span class="constructor">Marshal</span>.from_channel</code></a>;
   see the description of module <a href="Marshal.html"><code class="code"><span class="constructor">Marshal</span></code></a> for more information,
   in particular concerning the lack of type safety.</p>
</div>
</div>

<pre><span id="VALseek_in"><span class="keyword">val</span> seek_in</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">seek_in&nbsp;chan&nbsp;pos</code> sets the current reading position to <code class="code">pos</code>
   for channel <code class="code">chan</code>. This works only for regular files. On
   files of other kinds, the behavior is unspecified.</p>
</div>
</div>

<pre><span id="VALpos_in"><span class="keyword">val</span> pos_in</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the current reading position for the given channel.</p>
</div>
</div>

<pre><span id="VALin_channel_length"><span class="keyword">val</span> in_channel_length</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<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>

<pre><span id="VALclose_in"><span class="keyword">val</span> close_in</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Close the given channel.  Input functions raise a <code class="code"><span class="constructor">Sys_error</span></code>
  exception when they are applied to a closed input channel,
  except <code class="code">close_in</code>, which does nothing when applied to an already
  closed channel.</p>
</div>
</div>

<pre><span id="VALclose_in_noerr"><span class="keyword">val</span> close_in_noerr</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">close_in</code>, but ignore all errors.</p>
</div>
</div>

<pre><span id="VALset_binary_mode_in"><span class="keyword">val</span> set_binary_mode_in</span> : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_binary_mode_in&nbsp;ic&nbsp;<span class="keyword">true</span></code> sets the channel <code class="code">ic</code> to binary
   mode: no translations take place during input.
   <code class="code">set_binary_mode_out&nbsp;ic&nbsp;<span class="keyword">false</span></code> sets the channel <code class="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 class="code">\r\n</code> to <code class="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="2_Operationsonlargefiles">Operations on large files</h3>
<pre><span id="MODULELargeFile"><span class="keyword">module</span> <a href="Pervasives.LargeFile.html">LargeFile</a></span>: <code class="code"><span class="keyword">sig</span></code> <a href="Pervasives.LargeFile.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
<p>Operations on large files.</p>

</div>
<h2 id="1_References">References</h2>
<pre><code><span id="TYPEref"><span class="keyword">type</span> <code class="type">'a</code> ref</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span><span id="TYPEELTref.contents">contents</span>&nbsp;: <code class="type">'a</code>;</code></td>

</tr></table>
}

<div class="info ">
<div class="info-desc">
<p>The type of references (mutable indirection cells) containing
   a value of type <code class="code"><span class="keywordsign">'</span>a</code>.</p>
</div>
</div>


<pre><span id="VALref"><span class="keyword">val</span> ref</span> : <code class="type">'a -> 'a <a href="Pervasives.html#TYPEref">ref</a></code></pre><div class="info ">
<div class="info-desc">
<p>Return a fresh reference containing the given value.</p>
</div>
</div>

<pre><span id="VAL(!)"><span class="keyword">val</span> (!)</span> : <code class="type">'a <a href="Pervasives.html#TYPEref">ref</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">!r</code> returns the current contents of reference <code class="code">r</code>.
   Equivalent to <code class="code"><span class="keyword">fun</span>&nbsp;r&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;r.contents</code>.
   Unary operator at precedence level 11/11.</p>
</div>
</div>

<pre><span id="VAL(:=)"><span class="keyword">val</span> (:=)</span> : <code class="type">'a <a href="Pervasives.html#TYPEref">ref</a> -> 'a -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">r&nbsp;:=&nbsp;a</code> stores the value of <code class="code">a</code> in reference <code class="code">r</code>.
   Equivalent to <code class="code"><span class="keyword">fun</span>&nbsp;r&nbsp;v&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;r.contents&nbsp;&lt;-&nbsp;v</code>.
   Right-associative operator at precedence level 1/11.</p>
</div>
</div>

<pre><span id="VALincr"><span class="keyword">val</span> incr</span> : <code class="type">int <a href="Pervasives.html#TYPEref">ref</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Increment the integer contained in the given reference.
   Equivalent to <code class="code"><span class="keyword">fun</span>&nbsp;r&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;r&nbsp;:=&nbsp;succ&nbsp;!r</code>.</p>
</div>
</div>

<pre><span id="VALdecr"><span class="keyword">val</span> decr</span> : <code class="type">int <a href="Pervasives.html#TYPEref">ref</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Decrement the integer contained in the given reference.
   Equivalent to <code class="code"><span class="keyword">fun</span>&nbsp;r&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;r&nbsp;:=&nbsp;pred&nbsp;!r</code>.</p>
</div>
</div>
<h2 id="1_Resulttype">Result type</h2>
<pre><code><span id="TYPEresult"><span class="keyword">type</span> <code class="type">('a, 'b)</code> result</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTresult.Ok"><span class="constructor">Ok</span></span> <span class="keyword">of</span> <code class="type">'a</code></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTresult.Error"><span class="constructor">Error</span></span> <span class="keyword">of</span> <code class="type">'b</code></code></td>

</tr></table>

<div class="info ">
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>

<h2 id="1_Operationsonformatstrings">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.html"><code class="code"><span class="constructor">Scanf</span></code></a> and to print data with formatted output functions from modules
  <a href="Printf.html"><code class="code"><span class="constructor">Printf</span></code></a> and <a href="Format.html"><code class="code"><span class="constructor">Format</span></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 class="code"><span class="string">'%'</span></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 class="code"><span class="string">'@'</span></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 class="code"><span class="string">'%'</span></code>
  and <code class="code"><span class="string">'@'</span></code> in format strings: if a special character follows a <code class="code"><span class="string">'%'</span></code>
  character, it is treated as a plain character. In other words, <code class="code"><span class="string">"%%"</span></code> is
  considered as a plain <code class="code"><span class="string">'%'</span></code> and <code class="code"><span class="string">"%@"</span></code> as a plain <code class="code"><span class="string">'@'</span></code>.</p>

<p>For more information about conversion specifications and formatting
  indications available, read the documentation of modules <a href="Scanf.html"><code class="code"><span class="constructor">Scanf</span></code></a>,
  <a href="Printf.html"><code class="code"><span class="constructor">Printf</span></code></a> and <a href="Format.html"><code class="code"><span class="constructor">Format</span></code></a>.</p>
<p>Format strings have a general and highly polymorphic type
    <code class="code">(<span class="keywordsign">'</span>a,&nbsp;<span class="keywordsign">'</span>b,&nbsp;<span class="keywordsign">'</span>c,&nbsp;<span class="keywordsign">'</span>d,&nbsp;<span class="keywordsign">'</span>e,&nbsp;<span class="keywordsign">'</span>f)&nbsp;format6</code>.
    The two simplified types, <code class="code">format</code> and <code class="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 class="code"><span class="keywordsign">'</span>a</code> is the type of the parameters of the format for formatted output
      functions (<code class="code">printf</code>-style functions);
      <code class="code"><span class="keywordsign">'</span>a</code> is the type of the values read by the format for formatted input
      functions (<code class="code">scanf</code>-style functions).</li>
</ul>
<ul>
<li><code class="code"><span class="keywordsign">'</span>b</code> is the type of input source for formatted input functions and the
      type of output target for formatted output functions.
      For <code class="code">printf</code>-style functions from module <a href="Printf.html"><code class="code"><span class="constructor">Printf</span></code></a>, <code class="code"><span class="keywordsign">'</span>b</code> is typically
      <code class="code">out_channel</code>;
      for <code class="code">printf</code>-style functions from module <a href="Format.html"><code class="code"><span class="constructor">Format</span></code></a>, <code class="code"><span class="keywordsign">'</span>b</code> is typically
      <a href="Format.html#TYPEformatter"><code class="code"><span class="constructor">Format</span>.formatter</code></a>;
      for <code class="code">scanf</code>-style functions from module <a href="Scanf.html"><code class="code"><span class="constructor">Scanf</span></code></a>, <code class="code"><span class="keywordsign">'</span>b</code> is typically
      <a href="Scanf.Scanning.html#TYPEin_channel"><code class="code"><span class="constructor">Scanf</span>.<span class="constructor">Scanning</span>.in_channel</code></a>.</li>
</ul>
<p>Type argument <code class="code"><span class="keywordsign">'</span>b</code> is also the type of the first argument given to
      user's defined printing functions for <code class="code">%a</code> and <code class="code">%t</code> conversions,
      and user's defined reading functions for <code class="code">%r</code> conversion.</p>

<ul>
<li><code class="code"><span class="keywordsign">'</span>c</code> is the type of the result of the <code class="code">%a</code> and <code class="code">%t</code> printing
      functions, and also the type of the argument transmitted to the
      first argument of <code class="code">kprintf</code>-style functions or to the
      <code class="code">kscanf</code>-style functions.</li>
</ul>
<ul>
<li><code class="code"><span class="keywordsign">'</span>d</code> is the type of parameters for the <code class="code">scanf</code>-style functions.</li>
</ul>
<ul>
<li><code class="code"><span class="keywordsign">'</span>e</code> is the type of the receiver function for the <code class="code">scanf</code>-style functions.</li>
</ul>
<ul>
<li><code class="code"><span class="keywordsign">'</span>f</code> is the final result type of a formatted input/output function
      invocation: for the <code class="code">printf</code>-style functions, it is typically <code class="code">unit</code>;
      for the <code class="code">scanf</code>-style functions, it is typically the result type of the
      receiver function.</li>
</ul>

<pre><span id="TYPEformat6"><span class="keyword">type</span> <code class="type">('a, 'b, 'c, 'd, 'e, 'f)</code> format6</span> = <code class="type">('a, 'b, 'c, 'd, 'e, 'f) <a href="CamlinternalFormatBasics.html#TYPEformat6">CamlinternalFormatBasics.format6</a></code> </pre>


<pre><span id="TYPEformat4"><span class="keyword">type</span> <code class="type">('a, 'b, 'c, 'd)</code> format4</span> = <code class="type">('a, 'b, 'c, 'c, 'c, 'd) <a href="Pervasives.html#TYPEformat6">format6</a></code> </pre>


<pre><span id="TYPEformat"><span class="keyword">type</span> <code class="type">('a, 'b, 'c)</code> format</span> = <code class="type">('a, 'b, 'c, 'c) <a href="Pervasives.html#TYPEformat4">format4</a></code> </pre>


<pre><span id="VALstring_of_format"><span class="keyword">val</span> string_of_format</span> : <code class="type">('a, 'b, 'c, 'd, 'e, 'f) <a href="Pervasives.html#TYPEformat6">format6</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Converts a format string into a string.</p>
</div>
</div>

<pre><span id="VALformat_of_string"><span class="keyword">val</span> format_of_string</span> : <code class="type">('a, 'b, 'c, 'd, 'e, 'f) <a href="Pervasives.html#TYPEformat6">format6</a> -><br>       ('a, 'b, 'c, 'd, 'e, 'f) <a href="Pervasives.html#TYPEformat6">format6</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">format_of_string&nbsp;s</code> returns a format string read from the string
    literal <code class="code">s</code>.
    Note: <code class="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.html#VALformat_from_string"><code class="code"><span class="constructor">Scanf</span>.format_from_string</code></a> function.</p>
</div>
</div>

<pre><span id="VAL(^^)"><span class="keyword">val</span> (^^)</span> : <code class="type">('a, 'b, 'c, 'd, 'e, 'f) <a href="Pervasives.html#TYPEformat6">format6</a> -><br>       ('f, 'b, 'c, 'e, 'g, 'h) <a href="Pervasives.html#TYPEformat6">format6</a> -><br>       ('a, 'b, 'c, 'd, 'g, 'h) <a href="Pervasives.html#TYPEformat6">format6</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">f1&nbsp;^^&nbsp;f2</code> catenates format strings <code class="code">f1</code> and <code class="code">f2</code>. The result is a
  format string that behaves as the concatenation of format strings <code class="code">f1</code> and
  <code class="code">f2</code>: in case of formatted output, it accepts arguments from <code class="code">f1</code>, then
  arguments from <code class="code">f2</code>; in case of formatted input, it returns results from
  <code class="code">f1</code>, then results from <code class="code">f2</code>.
  Right-associative operator at precedence level 5/11.</p>
</div>
</div>
<h2 id="1_Programtermination">Program termination</h2>
<pre><span id="VALexit"><span class="keyword">val</span> exit</span> : <code class="type">int -> 'a</code></pre><div class="info ">
<div class="info-desc">
<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 class="code">flush_all</code>.
   An implicit <code class="code">exit&nbsp;0</code> is performed each time a program
   terminates normally.  An implicit <code class="code">exit&nbsp;2</code> is performed if the program
   terminates early because of an uncaught exception.</p>
</div>
</div>

<pre><span id="VALat_exit"><span class="keyword">val</span> at_exit</span> : <code class="type">(unit -> unit) -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Register the given function to be called at program termination
   time. The functions registered with <code class="code">at_exit</code> will be called when
   the program does any of the following:</p>
<ul>
<li>executes <a href="Pervasives.html#VALexit"><code class="code">exit</code></a></li>
<li>terminates, either normally or because of an uncaught
     exception</li>
<li>executes the C function <code class="code">caml_shutdown</code>.
   The functions are called in 'last in, first out' order: the
   function most recently added with <code class="code">at_exit</code> is called first.</li>
</ul>
</div>
</div>
</body></html>