Checking
int
- Range from to
- one bit is used at runtime (Garbage Collection) to distinguish int from pointers
- Tagged pointer representation
- integer - Why is an int in OCaml only 31 bits? - Stack Overflow
- OCaml library : Int64
- GitHub - ocaml/Zarith: The Zarith library implements arithmetic and logical operations over arbitrary-precision integers and rational numbers. The implementation, based on GMP, is very efficient.
float
int_of_float
float_of_int
char
char_of_int
int_of_char
string
- concatenation:
^
"abc".[0]
type variable
- or generic/polymorphic
'a
: unknown type
type
variant
Provide a type-safe way of doing something that might before have seemed impossible.
Variant types may mention their own name inside their own body
Polymorphic Variants
- You don’t have declare their type or constructors before using them.
- There is no name for a polymorphic variant type. (So another name for this feature could have been “anonymous variants”.)
- The constructors of a polymorphic variant start with a backquote character.