To focus the search input from anywhere on the page, press the 'S' key.
in-package search v0.1.0
- Exceptions
- Comparisons
- Boolean operations
- Debugging
- Composition operators
- Integer arithmetic
- Floating-point arithmetic
- String operations
- Character operations
- Unit operations
- String conversion functions
- Pair operations
- List operations
- Input/output
- References
- Result type
- Operations on format strings
- Program termination
- Standard library modules
-
bigarray
-
dynlink
-
ocamlbytecomp
-
ocamlcommon
-
ocamlmiddleend
-
ocamloptcomp
-
odoc_info
-
raw_spacetime_lib
-
-
stdlib
-
str
-
threads
-
unix
Library
Module
Module type
Parameter
Class
Class type
The OCaml Standard library.
This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by Stdlib
.
It particular, it provides the basic operations over the built-in types (numbers, booleans, byte sequences, strings, exceptions, references, lists, arrays, input-output channels, ...) and the standard library modules.
Exceptions
A faster version raise
which does not record the backtrace.
- since 4.02.0
The Exit
exception is not raised by any library function. It is provided for use in your programs.
Exception raised when none of the cases of a pattern-matching apply. The arguments are the location of the match keyword in the source code (file name, line number, column number).
Exception raised when an assertion fails. The arguments are the location of the assert keyword in the source code (file name, line number, column number).
Exception raised by library functions to signal that the given arguments do not make sense. The string gives some information to the programmer. As a general rule, this exception should not be caught, it denotes a programming error and the code should be modified not to trigger it.
Exception raised by library functions to signal that they are undefined on the given arguments. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Failure _ instead).
Exception raised by the garbage collector when there is insufficient memory to complete the computation. (Not reliable for allocations on the minor heap.)
Exception raised by the bytecode interpreter when the evaluation stack reaches its maximal size. This often indicates infinite or excessively deep recursion in the user's program.
Before 4.10, it was not fully implemented by the native-code compiler.
Exception raised by the input/output functions to report an operating system error. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Sys_error _ instead).
Exception raised by input functions to signal that the end of file has been reached.
Exception raised by integer division and remainder operations when their second argument is zero.
A special case of Sys_error raised when no I/O is possible on a non-blocking I/O channel.
Exception raised when an ill-founded recursive module definition is evaluated. The arguments are the location of the definition in the source code (file name, line number, column number).
Comparisons
e1 = e2
tests for structural equality of e1
and e2
. 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 Invalid_argument
. Equality between cyclic data structures may not terminate. Left-associative operator, see Ocaml_operators
for more information.
Negation of Stdlib.(=)
. Left-associative operator, see Ocaml_operators
for more information.
See Stdlib.(>=)
. Left-associative operator, see Ocaml_operators
for more information.
See Stdlib.(>=)
. Left-associative operator, see Ocaml_operators
for more information.
See Stdlib.(>=)
. Left-associative operator, see Ocaml_operators
for more information.
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 ( = )
. As in the case of ( = )
, mutable structures are compared by contents. Comparison between functional values raises Invalid_argument
. Comparison between cyclic structures may not terminate. Left-associative operator, see Ocaml_operators
for more information.
compare x y
returns 0
if x
is equal to y
, a negative integer if x
is less than y
, and a positive integer if x
is greater than y
. The ordering implemented by compare
is compatible with the comparison predicates =
, <
and >
defined above, with one difference on the treatment of the float value Stdlib.nan
. Namely, the comparison predicates treat nan
as different from any other float value, including itself; while compare
treats nan
as equal to itself and less than any other float value. This treatment of nan
ensures that compare
defines a total ordering relation.
compare
applied to functional values may raise Invalid_argument
. compare
applied to cyclic structures may not terminate.
The compare
function can be used as the comparison function required by the Set.Make
and Map.Make
functors, as well as the List.sort
and Array.sort
functions.
Return the smaller of the two arguments. The result is unspecified if one of the arguments contains the float value nan
.
Return the greater of the two arguments. The result is unspecified if one of the arguments contains the float value nan
.
e1 == e2
tests for physical equality of e1
and e2
. On mutable types such as references, arrays, byte sequences, records with mutable fields and objects with mutable instance variables, e1 == e2
is true if and only if physical modification of e1
also affects e2
. On non-mutable types, the behavior of ( == )
is implementation-dependent; however, it is guaranteed that e1 == e2
implies compare e1 e2 = 0
. Left-associative operator, see Ocaml_operators
for more information.
Negation of Stdlib.(==)
. Left-associative operator, see Ocaml_operators
for more information.
Boolean operations
The boolean 'and'. Evaluation is sequential, left-to-right: in e1 && e2
, e1
is evaluated first, and if it returns false
, e2
is not evaluated at all. Right-associative operator, see Ocaml_operators
for more information.
- deprecated
Stdlib.(&&)
should be used instead. Right-associative operator, seeOcaml_operators
for more information.
The boolean 'or'. Evaluation is sequential, left-to-right: in e1 || e2
, e1
is evaluated first, and if it returns true
, e2
is not evaluated at all. Right-associative operator, see Ocaml_operators
for more information.
- deprecated
Stdlib.(||)
should be used instead. Right-associative operator, seeOcaml_operators
for more information.