   Chapter 18 The core library

\$B\$3\$N>O\$G\$O(BObjective Caml core library module\$B!'(BPervasives module\$B\$K\$h\$jM?\$(\$i\$l\$k4X?t\$K\$D\$\$\$F5-=R\$9\$k!#(B \$B\$3\$N%b%8%e!<%k\$O#2\$D\$N0UL#\$GFCJL\$G\$"\$k!#(B
• \$B\$3\$N%b%8%e!<%k\$O(Bocamlc \$B\$K\$h\$j<+F0E*\$K%j%s%/\$5\$l\$k!#(B (chapter  8).

• \$B\$3\$N%b%8%e!<%k\$O%W%m%0%i%`3+;O;~\$K<+F0E*\$K(BOpen\$B\$5\$l\$k!#\$h\$C\$F(BPervasives module\$B\$N4X?t\$O%/%*%j%U%!%\$\$7\$F\$\$\$J\$\$4X?t\$b;H\$&\$3\$H\$,\$G\$-\$^\$9!#(B
 Conventions

Pervasives module\$B\$N%7%0%K%A%c\$NDj5A\$O%3%a%s%H\$H\$H\$b\$K\$3\$N%l%]!<%H\$N:G8e\$KNs5s\$9\$k!#(B

 18.1 Module Pervasives: the initially opened module

\$B\$3\$N%b%8%e!<%k\$O(Bbuilt-in\$B\$N7?(B(\$B?t!"??56CM!"J8;zNs!"Nc30!";2>H!"%j%9%H!"G[Ns!"F~=PNO\$J\$I(B)\$B\$H\$3\$l\$i\$rA`:n\$9\$k4X?t\$rDs6!\$9\$k!#(B

\$B\$3\$N%b%8%e!<%k\$O%3%s%Q%\$%k\$N\$O\$8\$a\$K<+F0E*\$K3+\$+\$l\$k!#\$h\$C\$F\$3\$N%b%8%e!<%k\$N%3%s%]%M%s%H\$O(B`Pervasives`\$B\$rIU\$1\$:\$K;2>H\$G\$-\$k!#(B
 Predefined types
`type int`
\$B@5?t7?!#(B
`type char`
\$BJ8;z7?!#(B
`type string`
\$BJ8;zNs7?!#(B
`type float`
\$BIbF0>.?tE@7?!#(B
`type bool`
\$B??56CM7?!#(B
`type unit = ()`
\$B%f%K%C%H7?!#(B
`type exn`
\$BNc307?!#(B
`type 'a array`
`'a`\$B7?\$NG[Ns7?!#(B
`type 'a list = [] | :: of 'a * 'a list`
`'a`\$B7?\$N%j%9%H7?!#(B
`type 'a option = None | Some of 'a`
\$B%*%W%7%g%J%k7?!#(B
`type ('a, 'b, 'c) format`
\$B%9%H%j%s%0\$N%U%)!<%^%C%H!#(B `'a`\$B\$O\$3\$N%U%)!<%^%C%H\$N7?0z?t!#(B , `'c`\$B\$O(B`printf`-\$B%9%?%\$%k\$N4X?t\$NJV\$jCM\$N7?!#(B , `'b`\$B\$O(B``` %a```\$B\$KM?\$(\$i\$l\$?:G=i\$N0z?t\$N7?!#(B `%t`\$B\$O%W%j%s%H4X?t!#(B ( `Printf`\$B%b%8%e!<%k;2>H!#(B).
 Exceptions
`val raise : exn -> 'a`
\$BM?\$(\$i\$l\$?Nc30\$NCM\$r(Braise\$B\$9\$k!#(B
`exception Match_failure of (string * int * int)`
\$B%Q%?!<%s%^%C%A%s%0\$K<:GT\$7\$?\$H\$-\$K(Braise\$B\$5\$l\$k!#0z?t\$O%Q%?!<%s%^%C%A%s%0\$N>l=j\$r5-\$7!"%U%!%\$%kL>!";O\$^\$j\$N0LCV!"=*\$j\$N0LCV\$G\$"\$k!#(B
`exception Assert_failure of (string * int * int)`
assertion\$B\$,<:GT\$7\$?\$H\$-\$KNc30\$,(Braise\$B\$5\$l\$k!#0z?t\$O%Q%?!<%s%^%C%A%s%0\$N>l=j\$G\$"\$k!#(BMatch_failure\$B\$r;2>H!#(B
`exception Invalid_argument of string`
\$B0z?t\$,0UL#\$r\$J\$5\$J\$\$>l9g\$K%7%0%J%k\$H\$7\$FNc30\$,Ej\$2\$i\$l\$k!#(B
`exception Failure of string`
\$BM?\$(\$i\$l\$?0z?t\$,Dj5A\$5\$l\$F\$\$\$J\$\$\$H\$-\$K%7%0%J%k\$H\$7\$FNc30\$,Ej\$2\$i\$l\$k!#(B
`exception Not_found`
\$BMW5a\$5\$l\$?%*%V%8%'%/%H\$,%5!<%A4X?t\$K\$h\$j8+\$D\$+\$i\$J\$+\$C\$?>l9g\$KEj\$2\$i\$l\$k!#(B
`exception Out_of_memory`
\$B7W;;\$9\$k\$N\$K%a%b%j\$,B-\$j\$J\$\$>l9g\$K%,!<%Y%8%3%l%/%?!<\$K\$h\$jEj\$2\$i\$l\$k!#(B
`exception Stack_overflow`
\$B?<\$9\$.\$k:F5"\$r9T\$C\$?:]\$K%9%?%C%/NN0h\$,B-\$j\$J\$/\$J\$C\$?>l9g\$K%P%\$%H%3!<%I%\$%s%?%W%j%?\$K\$h\$jEj\$2\$i\$l\$k!#(B
`exception Sys_error of string`
input/output\$B4X?t\$K\$h\$j(BOS\$B\$N%(%i!<\$N:]\$KEj\$2\$i\$l\$k!#(B
`exception End_of_file`
input\$B4X?t\$,%U%!%\$%k\$N=*\$j\$KC#\$7\$?\$H\$-\$K%7%0%J%k\$H\$7\$FEj\$2\$k!#(B
`exception Division_by_zero`
\$BBh(B2\$B0z?t\$,(B0\$B\$G3d\$j;;\$,8F\$P\$l\$?\$H\$-\$KEj\$2\$i\$l\$k!#(B
`exception Exit`
\$B\$3\$NNc30\$O%i%\$%V%i%j\$K\$h\$jEj\$2\$i\$l\$k\$N\$G\$O\$J\$/%W%m%0%i%`Cf\$GDs6!\$5\$l\$k!#(B
`exception Sys_blocked_io`
`Sys_error` \$B\$I\$N(BI/O\$B\$b(B non-blocking I/O channel\$B>e\$K@.\$jN)\$?\$J\$\$\$H\$\$\$&FCJL\$J>l9g\$KEj\$2\$i\$l\$k!#(B
`val invalid_arg: string -> 'a`
\$BNc30(B`Invalid_argument` \$B\$rJ8;zNs\$H\$H\$b\$KEj\$2\$k!#(B
`val failwith: string -> 'a`
\$BNc30(B``` Failure```\$B\$rJ8;zNs\$H\$H\$b\$KEj\$2\$k!#(B
 Comparisons
`val (=) : 'a -> 'a -> bool`
``` e1 = e2``` `e1` \$B\$H(B `e2`\$B\$N9=B\$Ey2A\$r3N\$+\$a\$k!#(B \$B;2>H\$dG[Ns\$J\$I\$N2DJQ\$N9=B\$\$N8=:_\$NCM\$,9=B\$E*\$KF1\$8\$G\$"\$k>l9g\$N\$_\$K8B\$jEy2A\$G\$"\$k\$H\$9\$k!##2\$D\$N2DJQ%*%V%8%'%/%H\$,J*M}E*\$KF1\$8\$G\$J\$/\$H\$b\$h\$\$!#(B \$B4X?t\$,0z?t\$K\$H\$i\$l\$k\$H(B`Invalid_argument`\$B\$rEj\$2\$k!#(B cyclic data\$B9=B\$\$NF)2a@-\$O;_\$^\$i\$J\$\$2DG=@-\$,\$"\$k!#(B
`val (<>) : 'a -> 'a -> bool`
``` (=)```\$B\$NH]Dj(B.
`val (<) : 'a -> 'a -> boolval (>) : 'a -> 'a -> boolval (<=) : 'a -> 'a -> boolval (>=) : 'a -> 'a -> bool`
\$B9=B\$E*=g=xIU\$14X?t!#(B \$B\$3\$l\$i\$O@0?t!"J8;z!"J8;zNs!"IbF0>.?tE@?t!"\$J\$I\$N=g=xIU\$-\$N%G!<%?\$KMQ\$\$\$i\$l\$k!#\$3\$l\$r3HD%\$7\$FA4\$F\$N7?\$N=g=xIU\$1\$,2DG=\$G\$"\$k!#(B \$B=g=xIU\$1\$O(B``` (=)```\$B\$H8_49@-\$,\$"\$k!#(B `(=)`\$B\$G8+\$?\$H\$-\$N\$h\$&\$K(B,\$B2DJQ\$N%G!<%?\$N>l9g\$OCf?H\$GHf\$Y\$i\$l\$k!#(B \$B4X?t7?\$rHf\$Y\$k\$H(B``` Invalid_argument```\$B\$,Ej\$2\$i\$l\$k!#(B Cyclic\$B\$J%G!<%?\$rHf3S\$9\$k\$H;_\$^\$i\$J\$\$!#(B
`val compare: 'a -> 'a -> int`
``` compare x y``` \$B\$O(B`x=y`\$B\$J\$i\$P(B `0`\$B\$r(B, `x<y` \$B\$J\$i\$PIi\$N@0?t\$r(B,`x>y`\$B\$J\$i\$P@5\$N@0?t\$rJV\$9!#(B `=`\$B\$rE,MQ\$9\$k\$H\$-\$HF1MM\$N@)8B\$,\$"\$k(B``` compare``` \$B\$OHf3S4X?t\$H\$7\$F(B`Set` \$B\$H(B `Map`\$B%b%8%e!<%k\$G;H\$o\$l\$k!#(B
`val min: 'a -> 'a -> 'a`
2\$B0z?t\$N\$&\$A\$N>.\$5\$\$J}\$rJV\$9!#(B
`val max: 'a -> 'a -> 'a`
2\$B0z?t\$N\$&\$A\$NBg\$-\$\$J}\$rJV\$9!#(B
`val (==) : 'a -> 'a -> bool`
`e1 == e2` `e1` \$B\$H(B `e2`\$B\$NJ*M}E*Ey2A@-\$r%A%'%C%/\$9\$k!#(B \$B@5?t7?!"J8;z7?\$N>l9g\$O9=B\$Ey2A\$HF1\$8!#2DJQ9=B\$\$N>l9g\$O(B ``` e1 == e2``` \$B\$O(B `e1`\$B\$bJQ99\$,(B `e2`\$B\$K\$b1F6A\$rM?\$(\$k\$h\$&\$JJ*M}E*\$KF1\$8\$G\$"\$k>l9g\$K\$N\$_(Btrue\$B\$H\$J\$k!#(B \$B2DJQ9=B\$\$G\$J\$\$>l9g\$O(B, `(==)`\$B\$NF/\$-\$Oe1 == e2\$B\$O(B``` e1 = e2```\$B\$r0UL#\$9\$k!#(B
`val (!=) : 'a -> 'a -> bool`
`(==)`\$B\$NH]Dj!#(B
 Boolean operations
`val not : bool -> bool`
\$B??56CM\$NH]Dj!#(B
`val (&&) : bool -> bool -> boolval (&) : bool -> bool -> bool`
\$B??56\$N(B``and''\$B!#I>2A\$O:8\$+\$i1&\$X\$H9T\$o\$l\$k!#(B `e1 && e2`\$B\$G\$O(B`e1` \$B\$,@h\$KI>2A\$5\$l\$3\$l\$,(Bfalse\$B\$rJV\$9>l9g\$O(B`e2`\$B\$OI>2A\$5\$l\$J\$\$!#(B
`val (||) : bool -> bool -> boolval (or) : bool -> bool -> bool`
\$B??56\$N(B``or''\$B!#I>2A\$O:8\$+\$i1&\$X\$H9T\$o\$l\$k!#(B `e1 && e2`\$B\$G\$O(B`e1`\$B\$,@h\$KI>2A\$5\$l\$3\$l\$,(Btrue\$B\$rJV\$9>l9g\$O(B``` e2```\$B\$OI>2A\$5\$l\$J\$\$!#(B
 \$B@0?t1i;;(B
\$B@0?t\$N%S%C%HI}\$O(B31\$B%S%C%H\$G\$"\$k(B(64\$B%S%C%H%W%m%;%C%5\$N>l9g\$O(B63\$B%S%C%H(B). \$B\$9\$Y\$F\$N7W;;\$O(B 231\$B\$N(Bmodulo(\$B\$^\$?\$O(B 2 63)\$B\$G9T\$J\$o\$l\$k(B. \$B%*!<%P!<%U%m!<\$K4X\$7\$F<:GT\$O\$7\$J\$\$!#(B.
`val (~-) : int -> int`
Unary negation. You can also write `-e` instead of `~-e` .
`val succ : int -> int`
`succ x` \$B\$O(B `x+1`\$B\$HF15A(B.
`val pred : int -> int`
`pred x` \$B\$O(B `x-1`\$B\$HF15A(B.
`val (+) : int -> int -> int`
\$B@0?t\$NOB(B.
`val (-) : int -> int -> int`
\$B@0?t\$N:9(B.
`val (*) : int -> int -> int`
\$B@0?t\$N@Q(B.
`val (/) : int -> int -> int`
\$B@0?t\$N>&(B. \$BBh(B2\$B0z?t\$,(B0\$B\$N>l9g\$O(B`Division_by_zero`\$B\$,(Braise\$B\$5\$l\$k!#(B
`val (mod) : int -> int -> int`
\$B@0?t\$NM>\$j\$N7W;;(B. \$B\$b\$7(B `x >= 0` and `y > 0`\$B\$G\$"\$k\$J\$i\$P(B, `x mod y` ``` 0 <= x mod y < y``` and `x = (x / y) * y + x mod y`\$B\$rK~\$?\$9(B. \$B\$b\$7(B `y = 0`\$B\$J\$i\$P(B, `x mod y` \$B\$O(B `Division_by_zero`\$B\$r(B raise\$B\$9\$k!#(B . `x < 0` \$B\$^\$?\$O(B `y < 0`\$B\$N>l9g\$N(B``` x mod y```\$B\$N7W;;7k2L\$O;XDj\$5\$l\$F\$*\$i\$:!"%W%i%C%H%[!<%`0MB8\$G\$"\$k(B.
`val abs : int -> int`
\$B0z?t\$N@0?t\$N@dBPCM\$rJV\$9(B.
`val max_int: intval min_int: int`
\$B;HMQ2DG=\$J@0?t\$N:GBgCM\$H:G>.CM(B.
 \$B%S%C%H1i;;(B
`val (land) : int -> int -> int`

\$B%S%C%H\$4\$H\$NO@M}@Q!#(B
`val (lor) : int -> int -> int`

\$B%S%C%H\$4\$H\$NO@M}OB!#(B
`val (lxor) : int -> int -> int`
\$B%S%C%H\$4\$H\$NGSB>E*O@M}OB!#(B
`val lnot: int -> int`
\$B%S%C%H\$4\$H\$NO@M}E*H]Dj!#(B
`val (lsl) : int -> int -> int`
`n lsl m`\$B\$O(B `n` \$B\$r:8\$K(B `m` \$B%S%C%H%7%U%H\$7\$?CM\$rJV\$9(B. `m < 0` \$B\$N>l9g\$d(B ```(m >= \$B%S%C%H%5%\$%:(B)```\$B\$N>l9g\$N7k2L\$O5,Dj\$5\$l\$F\$\$\$J\$\$(B, \$B\$3\$3\$G\$\$\$&(B`\$B%S%C%H%5%\$%:(B` \$B\$H\$O(B32\$B%S%C%H%W%i%C%H%[!<%`\$N>l9g\$O(B `32` \$B\$G(B 64\$B%S%C%H%W%i%C%H%[!<%`\$N>l9g\$O(B`64` \$B\$G\$"\$k(B.
`val (lsr) : int -> int -> int`
`n lsr m`\$B\$O(B `n` \$B\$r1&\$K(B `m` \$B%S%C%H%7%U%H\$7\$?CM\$rJV\$9(B. \$B\$3\$l\$OO@M}%7%U%H\$G\$"\$k(B: `n`\$B\$NId9g\$K\$h\$i\$:(B 0\$B\$,A^F~\$5\$l\$k(B. `m < 0`\$B\$^\$?\$O(B ``` m >= \$B%S%C%H%5%\$%:(B```\$B\$N>l9g\$N7k2L\$O5,Dj\$5\$l\$F\$\$\$J\$\$(B.
`val (asr) : int -> int -> int`
`n lsr m`\$B\$O(B `n` \$B\$r1&\$K(B `m` \$B%S%C%H%7%U%H\$7\$?CM\$rJV\$9(B. \$B\$3\$l\$O;;=Q%7%U%H\$G\$"\$k(B: `n`\$B\$NId9g%S%C%H\$,J#@=\$5\$l\$k(B. ``` m >= \$B%S%C%H%5%\$%:(B```\$B\$N>l9g\$N7k2L\$O5,Dj\$5\$l\$F\$\$\$J\$\$(B.
 \$BIbF0>.?t1i;;(B
Caml\$B\$O(B IEEE754\$B\$NI8=`\$K=`5r\$7\$?(B \$BG\?t@:EY(B(64\$B%S%C%H(B)\$B\$NIbF0>.?t\$rMQ\$\$\$k(B. \$BIbF0>.?t1i;;\$O(B \$B%*!<%P!<%U%m!\$l\$N>l9g\$KE,@Z\$JFCJL\$J(BIEEE\$B?t\$,JV\$5\$l\$k!#(B \$B\$?\$H\$(\$P(B ```1.0 /. 0.0```\$B\$K\$O(B`infinity` , `-1.0 /. 0.0`\$B\$K\$O(B`neg_infinity` , `0.0 /. 0.0`\$B\$K\$O(B` nan` (``not a number'')\$B\$,\$=\$l\$>\$lJV\$5\$l\$k(B . \$B\$3\$l\$i\$NFCJL\$J?tCM\$O(B \$BIbF0>.?tE@1i;;\$K<+A3\$KE,MQ\$5\$l\$k!#Nc\$r5s\$2\$k\$H(B`1.0 /. infinity` \$B\$O(B `0.0`\$B\$K\$J\$j(B, `nan`\$B\$r0z?t\$K\$H\$k7W;;\$O\$9\$Y\$F(B`nan`\$B\$rJV\$9(B.
`val (~-.) : float -> float`
Unary negation. You can also write `-.e` instead of `~-.e` .
`val (+.) : float -> float -> float`
Floating-point addition
`val (-.) : float -> float -> float`
Floating-point subtraction
`val (*.) : float -> float -> float`
Floating-point multiplication
`val (/.) : float -> float -> float`
Floating-point division.
`val (**) : float -> float -> float`
Exponentiation
`val sqrt : float -> float`
Square root
`val exp : float -> floatval log : float -> floatval log10 : float -> float`
Exponential, natural logarithm, base 10 logarithm.
`val cos : float -> floatval sin : float -> floatval tan : float -> floatval acos : float -> floatval asin : float -> floatval atan : float -> floatval atan2 : float -> float -> float`
The usual trigonometric functions
`val cosh : float -> floatval sinh : float -> floatval tanh : float -> float`
The usual hyperbolic trigonometric functions
`val ceil : float -> floatval floor : float -> float`
Round the given float to an integer value. `floor f` returns the greatest integer value less than or equal to `f`. ```ceil f``` returns the least integer value greater than or equal to `f` .
`val abs_float : float -> float`
Return the absolute value of the argument.
`val mod_float : float -> float -> float`
`mod_float a b` returns the remainder of `a` with respect to `b`. The returned value is `a -. n *. b` , where `n` is the quotient `a /. b` rounded towards zero to an integer.
`val frexp : float -> float * int`
`frexp f` returns the pair of the significant and the exponent of `f`. When `f` is zero, the significant `x` and the exponent `n` of `f` are equal to zero. When ``` f``` is non-zero, they are defined by `f = x *. 2 ** n` and ``` 0.5 <= x < 1.0```.
`val ldexp : float -> int -> float`
`ldexp x n` returns `x *. 2 ** n`.
`val modf : float -> float * float`
`modf f` returns the pair of the fractional and integral part of `f`.
`val float : int -> floatval float_of_int : int -> float`
Convert an integer to floating-point.
`val truncate : float -> intval int_of_float : float -> int`
Truncate the given floating-point number to an integer. The result is unspecified if it falls outside the range of representable integers.
`val infinity: float`
Positive infinity.
`val neg_infinity: float`
Negative infinity.
`val nan: float`
A special floating-point value denoting the result of an undefined operation such as `0.0 /. 0.0`. Stands for ``not a number''.
`type fpclass =    FP_normal           (* Normal number, none of the below *)  | FP_subnormal        (* Number very close to 0.0, has reduced precision *)  | FP_zero             (* Number is 0.0 or -0.0 *)  | FP_infinite         (* Number is positive or negative infinity *)  | FP_nan              (* Not a number: result of an undefined operation *)`
The five classes of floating-point numbers, as determined by the `classify_float` function.
`val classify_float: float -> fpclass`
Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number.
 String operations
More string operations are provided in module `String`.
`val (^) : string -> string -> string`
\$BJ8;zNs\$N7k9g!#(B
 Character operations
More character operations are provided in module `Char`.
`val int_of_char : char -> int`
\$BJ8;z\$N%"%9%-!<%3!<%I\$rJV\$9!#(B
`val char_of_int : int -> char`
Return the character with the given ASCII code. Raise ```Invalid_argument "char_of_int"``` if the argument is outside the range 0--255.
 Unit operations
`val ignore : 'a -> unit`
Discard the value of its argument and return `()`. For instance, ``` ignore(f x)``` discards the result of the side-effecting function ``` f```. It is equivalent to `f x; ()`, except that the latter may generate a compiler warning; writing `ignore(f x)` instead avoids the warning.
 String conversion functions
`val string_of_bool : bool -> string`
\$B??56CM\$rI=\$9J8;zNs\$rJV\$9!#(B
`val bool_of_string : string -> bool`
Convert the given string to a boolean. Raise `Invalid_argument "bool_of_string"` if the string is not `"true"` or `"false"`.
`val string_of_int : int -> string`
Return the string representation of an integer, in decimal.
`val int_of_string : string -> int`
Convert the given string to an integer. The string is read in decimal (by default) or in hexadecimal, octal or binary if the string begins with ``` 0x```, `0o` or `0b` respectively. Raise ```Failure "int_of_string"``` if the given string is not a valid representation of an integer.
`val string_of_float : float -> string`
Return the string representation of a floating-point number.
`val float_of_string : string -> float`
Convert the given string to a float. The result is unspecified if the given string is not a valid representation of a float.
 Pair operations
`val fst : 'a * 'b -> 'a`
Return the first component of a pair.
`val snd : 'a * 'b -> 'b`
Return the second component of a pair.
 List operations
More list operations are provided in module `List`.
`val (@) : 'a list -> 'a list -> 'a list`
List concatenation.
 Input/output
`type in_channeltype out_channel`
\$B%\$%s%W%C%H%A%c%s%M%k\$H%"%&%H%W%C%H%A%c%s%M%k\$N7?!#(B
`val stdin : in_channelval stdout : out_channelval stderr : out_channel`
\$B\$=\$N%W%m%;%9\$NI8=`F~NO!"I8=`=PNO!"I8=`%(%i!<=PNO!#(B
 Output functions on standard output
`val print_char : char -> unit`
\$BI8=`=PNO\$KJ8;z\$r%W%j%s%H!#(B
`val print_string : string -> unit`
\$BI8=`=PNO\$KJ8;zNs\$rEG\$/!#(B
`val print_int : int -> unit`
\$BI8=`=PNO\$K(B10\$B?J?t\$G@0?t\$rI=<(!#(B
`val print_float : float -> unit`
\$BI8=`=PNO\$K(B10\$B?J?t\$GIbF0>.?tE@\$rI=<(!#(B
`val print_endline : string -> unit`
\$B%9%H%j%s%0\$r2~9TJ8;zIU\$-\$GI8=`=PNO\$KI=<(!#(B
`val print_newline : unit -> unit`
\$BI8=`=PNO\$K2~9TJ8;z\$r=q\$-!"I8=`=PNO\$r%U%i%C%7%e\$9\$k!#(B \$B\$3\$l\$OI8=`=PNO\$r%i%\$%s%P%C%U%!\$H\$7\$F%7%_%e%l!<%H\$9\$k\$3\$H\$r2DG=\$H\$9\$k!#(B
 \$BI8=`%(%i!<=PNO\$X\$N=PNO4X?t!#(B
`val prerr_char : char -> unit`
\$BI8=`%(%i!<=PNO\$KJ8;z\$r=PNO!#(B
`val prerr_string : string -> unit`
Print a string on standard error.
`val prerr_int : int -> unit`
Print an integer, in decimal, on standard error.
`val prerr_float : float -> unit`
Print a floating-point number, in decimal, on standard error.
`val prerr_endline : string -> unit`
Print a string, followed by a newline character on standard error and flush standard error.
`val prerr_newline : unit -> unit`
Print a newline character on standard error, and flush standard error.
 \$BI8=`F~NO\$+\$i\$NF~NO!#(B
`val read_line : unit -> string`
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.
`val read_int : unit -> int`
Flush standard output, then read one line from standard input and convert it to an integer. Raise `Failure "int_of_string"` if the line read is not a valid representation of an integer.
`val read_float : unit -> float`
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.
 \$B0lHLE*\$J=PNO4X?t(B
`type open_flag =    Open_rdonly | Open_wronly | Open_append  | Open_creat | Open_trunc | Open_excl  | Open_binary | Open_text | Open_nonblock`
`open_out_gen` \$B\$H(B `open_in_gen`\$B\$N\$?\$a\$N%U%!%\$%k\$N%*!<%W%s%b!<%I!#(B
``` Open_rdonly```: \$BFI\$_9~\$_MQ!#(B
``` Open_wronly```: \$B=q\$-9~\$_MQ!#(B
``` Open_append```: \$BDI5-MQ!#(B
``` Open_creat```: \$B%U%!%\$%k\$,L5\$+\$C\$?>l9g\$N:n@.MQ!#(B
``` Open_trunc```: empty the file if it already exists.
``` Open_excl```: fail if the file already exists.
``` Open_binary```: open in binary mode (no conversion).
``` Open_text```: open in text mode (may perform conversions).
``` Open_nonblock```: open in non-blocking mode.
`val open_out : string -> out_channel`

\$B;XDj\$5\$l\$?L>A0\$N%U%!%\$%k\$r=PNOMQ\$K3+\$/!#%]%8%7%g%s\$O%U%!%\$%k\$N;O\$a\$NItJ,\$H\$J\$k!#\$b\$7%U%!%\$%k\$,4{\$KB8:_\$7\$F\$\$\$?\$i\$3\$N%U%!%\$%k\$ND9\$5\$O#0\$K\$5\$l\$k!#\$b\$7%U%!%\$%k\$,B8:_\$7\$F\$\$\$J\$+\$C\$?\$i?7\$7\$/:n\$i\$l\$k!#%U%!%\$%k\$,3+\$1\$J\$\$>l9g\$O(BSys_error\$B\$,%l%\$%:\$5\$l\$k!#(B
`val open_out_bin : string -> out_channel`
Same as `open_out`, 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 `open_out`.
`val open_out_gen : mode:open_flag list -> perm:int -> string -> out_channel`
Open the named file for writing, as above. The extra argument `mode` specify the opening mode. The extra argument `perm` specifies the file permissions, in case the file must be created. `open_out` and `open_out_bin` are special cases of this function.
`val flush : out_channel -> unit`
\$B\$=\$N%A%c%s%M%k\$N%P%C%U%!\$r%U%i%C%7%e\$7%A%c%s%M%k\$K=q\$-9~\$`!#%\$%s%?%i%/%F%#%V\$J%W%m%0%i%`\$N>l9g\$OJbI8=`=PNO\$dI8=`%(%i!<=PNO\$K=q\$-9~\$`%?%\$%_%s%0\$K5\$\$r\$D\$1\$J\$/\$F\$O\$J\$i\$J\$\$!#(B
`val output_char : out_channel -> char -> unit`
Write the character on the given output channel.
`val output_string : out_channel -> string -> unit`
Write\$B%"%&%H%W%C%H%A%c%s%M%k\$KJ8;zNs\$r=q\$-9~\$`!#(B
`val output : out_channel -> buf:string -> pos:int -> len:int -> unit`
Write `len` characters from string `buf`, starting at offset `pos`, to the given output channel. Raise ```Invalid_argument "output"``` if `pos` and `len` do not designate a valid substring of `buf`.
`val output_byte : out_channel -> int -> unit`
Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.
`val output_binary_int : out_channel -> int -> unit`
Write one integer in binary format on the given output channel. The only reliable way to read it back is through the `input_binary_int` function. The format is compatible across all machines for a given version of Objective Caml.
`val output_value : out_channel -> 'a -> unit`
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 `input_value`. See the description of module `Marshal` for more information. `output_value` is equivalent to `Marshal.to_channel` with an empty list of flags.
`val seek_out : out_channel -> int -> unit`
`seek_out chan pos` sets the current writing position to ``` pos``` for channel `chan`. This works only for regular files. On files of other kinds (such as terminals, pipes and sockets), the behavior is unspecified.
`val pos_out : out_channel -> int`
Return the current writing position for the given channel.
`val out_channel_length : out_channel -> int`
Return the total length (number of characters) of the given channel. This works only for regular files. On files of other kinds, the result is meaningless.
`val close_out : out_channel -> unit`
Close the given channel, flushing all buffered write operations. A ``` Sys_error``` exception is raised if any of the functions above is called on a closed channel.
`val set_binary_mode_out : out_channel -> bool -> unit`
`set_binary_mode_out oc true` sets the channel `oc` to binary mode: no translations take place during output. ```set_binary_mode_out oc false``` sets the channel `oc` 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 `\n` to `\r\n`. This function has no effect under operating systems that do not distinguish between text mode and binary mode.
 \$B0lHLE*\$JF~NO4X?t(B
`val open_in : string -> in_channel`
\$BJ8;zNs\$K\$h\$j<(\$5\$l\$?%U%!%\$%k\$rFI\$_9~\$_MQ\$K3+\$-!"\$=\$NF~NO%A%c%s%M%k\$rJV\$9!#%]%8%7%g%s\$O%U%!%\$%k\$N:G=i\$K\$5\$l\$F\$\$\$k!#%U%!%\$%k\$r3+\$1\$J\$\$>l9g\$O(BSys_error\$B\$,%l%\$%:\$5\$l\$k!#(B
`val open_in_bin : string -> in_channel`
Same as `open_in`, 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 `open_in`.
`val open_in_gen : mode:open_flag list -> perm:int -> string -> in_channel`
Open the named file for reading, as above. The extra arguments `mode` and `perm` specify the opening mode and file permissions. ``` open_in``` and `open_in_bin` are special cases of this function.
`val input_char : in_channel -> char`
Read one character from the given input channel. Raise `End_of_file` if there are no more characters to read.
`val input_line : in_channel -> string`
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 `End_of_file` if the end of the file is reached at the beginning of line.
`val input : in_channel -> buf:string -> pos:int -> len:int -> int`
Read up to `len` characters from the given channel, storing them in string `buf`, starting at character number `pos` . It returns the actual number of characters read, between 0 and `len` (inclusive). A return value of 0 means that the end of file was reached. A return value between 0 and `len` exclusive means that not all requested `len` 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; `input` must be called again to read the remaining characters, if desired. (See also `Pervasives.really_input` for reading exactly `len` characters.) Exception ```Invalid_argument "input"``` is raised if `pos` and `len` do not designate a valid substring of `buf`.
`val really_input : in_channel -> buf:string -> pos:int -> len:int -> unit`
Read `len` characters from the given channel, storing them in string `buf`, starting at character number `pos`. Raise ``` End_of_file``` if the end of file is reached before `len` characters have been read. Raise `Invalid_argument "really_input"` if ``` pos``` and `len` do not designate a valid substring of ``` buf```.
`val input_byte : in_channel -> int`
Same as `input_char`, but return the 8-bit integer representing the character. Raise `End_of_file` if an end of file was reached.
`val input_binary_int : in_channel -> int`
Read an integer encoded in binary format from the given input channel. See ``` output_binary_int```. Raise `End_of_file` if an end of file was reached while reading the integer.
`val input_value : in_channel -> 'a`
Read the representation of a structured value, as produced by `output_value` , and return the corresponding value. This function is identical to ``` Marshal.from_channel```; see the description of module `Marshal` for more information, in particular concerning the lack of type safety.
`val seek_in : in_channel -> int -> unit`
`seek_in chan pos` sets the current reading position to ``` pos``` for channel `chan`. This works only for regular files. On files of other kinds, the behavior is unspecified.
`val pos_in : in_channel -> int`
Return the current reading position for the given channel.
`val in_channel_length : in_channel -> int`
Return the total length (number of characters) of the given channel. This works only for regular files. On files of other kinds, the result is meaningless.
`val close_in : in_channel -> unit`
Close the given channel. A `Sys_error` exception is raised if any of the functions above is called on a closed channel.
`val set_binary_mode_in : in_channel -> bool -> unit`
`set_binary_mode_in ic true` sets the channel `ic` to binary mode: no translations take place during input. ```set_binary_mode_out ic false``` sets the channel `ic` 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 `\r\n` to `\n`. This function has no effect under operating systems that do not distinguish between text mode and binary mode.
 References
`type 'a ref = { mutable contents: 'a }`
The type of references (mutable indirection cells) containing a value of type `'a`.
`val ref : 'a -> 'a ref`
Return a fresh reference containing the given value.
`val (!) : 'a ref -> 'a`
`!r` returns the current contents of reference `r` . Equivalent to `fun r -> r.contents`.
`val (:=) : 'a ref -> 'a -> unit`
`r := a` stores the value of `a` in reference ``` r```. Equivalent to `fun r v -> r.contents <- v`.
`val incr : int ref -> unit`
Increment the integer contained in the given reference. Equivalent to ``` fun r -> r := succ !r```.
`val decr : int ref -> unit`
Decrement the integer contained in the given reference. Equivalent to ``` fun r -> r := pred !r```.
 Program termination
`val exit : int -> 'a`
Flush all pending writes on `stdout` and `stderr`, and 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.) An implicit `exit 0` is performed each time a program terminates normally (but not if it terminates because of an uncaught exception).
`val at_exit: (unit -> unit) -> unit`
Register the given function to be called at program termination time. The functions registered with `at_exit` will be called when the program executes `exit`. They will not be called if the program terminates because of an uncaught exception. The functions are called in ``last in, first out'' order: the function most recently added with `at_exit` is called first.   Caution!
\$B\$3\$NJ8>O\$O(B\$B1JED(B\$B\$,<+J,%a%b\$N\$?\$a\$K(BOcaml\$B\$N(BUser's manual\$B\$r>!