![]() | ![]() | ![]() |
|
string itoa(int t); | |
| Return decimal string representation of i. | |
int atoi(string s); | |
| Convert s from decimal string to integer. If s is not valid decimal integer with optional white spaces at the beginning and at the end Invalid_argument is raised. This is different from atoi(3), for example in C atoi("3ble") == 3, in Gont exception is raised. | |
string ftoa(float f); | |
| Return decimal string representation of f. | |
float atof(string); | |
| Convert s from decimal string to float. If s is not valid floating point number (as with strtod(3)), with optional white spaces at the beginning and at the end Invalid_argument is raised. | |
string string_of_bool(bool b); | |
| Return either "true" iff b == true or "false" otherwise. | |
bool bool_of_string(string s); | |
| Return true iff s == "true", false iff s == "false", raise Invalid_argument otherwise. | |
string int_of_string(int); | |
| An alias for Core::itoa. | |
int string_of_int(string); | |
| An alias for Core::atoi. | |
string string_of_float(float); | |
| An alias for Core::ftoa. | |
float float_of_string(string); | |
| An alias for Core::atof. | |
void ignore('a f); | |
| f is ignored. It is useful if you want discard return value of function, and don't want warning, then you do: ignore(f()). Of course this is only relevant if you compile with -Wignored-retval. | |
*('a ('b)) partial(*('a ('c, 'b)) f, 'c c); | |
| Return f partially evaluated on c, i.e. fun (x) f(c, x). | |
*('a ('b)) partial2(*('a ('c, 'd, 'b)) f, 'c c, 'd d); | |
| Return f partially evaluated on c, d, i.e. fun (x) f(c, d, x). | |
void puts(string s); | |
| Print s on stdout. Note that it doesn't append "\n". | |
void puts_err(string s); | |
| Print s on stderr. | |
string read_line(); | |
| Read and return one line of input from stdin. | |
int read_int(); | |
| Read one word (sequence of non-white-space characters) from stdin, and return it converted to int. It's more or less the same as scanf("%i", &i); in C. | |
float read_float(); | |
| Read one word (sequence of non-white-space characters) from stdin, and return it converted to int. It's more or less the same as scanf("%f", &f); in C. | |
string read_string(); | |
| Read one word (sequence of non-white-space characters) from stdin, and return it. It's more or less the same as scanf("%s", buf); in C. | |
'a fst(*('a, 'b) p); | |
| Return first element of pair p. | |
'b snd(*('a, 'b) p); | |
| Return second element of pair p. | |
type char; | |
| Type of characters. | |
char char_of_int(int x); | |
| Return unicode character number x. Raise Invalid_argument if x is outside allowed range (0 - 2^31-1). | |
int int_of_char(char x); | |
| Return unicode number of x. | |
union <'a>list {
void Nil;
*('a, <'a>list) Cons;
} | |
| Type of immutable, ML-style lists. See List module for operations on lists. | |
struct <'a>ref {
'a ref_contents;
} | |
| Type of mutable references. | |
'a ref_get(<'a>ref r); | |
| Get value from reference r. | |
<'a>ref ref_make('a data); | |
| Make reference out of a. | |
void ref_set(<'a>ref r, 'a a); | |
| Set value in reference r to a. | |
union <'a>option {
void None;
'a Some;
} | |
| Option type. | |
Standard exceptions.
exception void Match_failure; | |
| Raised when none of pattern clauses matched expression. | |
exception void Null_access; | |
| Raised upon attempt to access opt_struct that is null. | |
exception string Invalid_argument; | |
| Raised by various library functions, when they are given arguments they can't handle. | |
exception string Failure; | |
| Raised by library functions, that are undefined for given arguments. | |
exception void Not_found; | |
| Raised by library functions, when object to be returned was not to be found. | |
exception string Sys_error; | |
| Raised by library functions that had problems with underlaying C functions, This generally involves strerror(errno). | |
exception void End_of_file; | |
| Raised by input functions, when end of file is reached. | |
Unicode exceptions.
exception void Invalid_multibyte_sequence; | |
| Can be raised during conversion from some external encoding to string. | |
exception void Incomplete_multibyte_sequence; | |
| Can be raised during conversion from some external encoding to string. | |
exception void Invalid_unicode_character; | |
| Can be raised uppon conversion from <char>Array::t to external encoding or string, when some character exceeds 2^31. | |
exception void Character_not_supported_by_encoding; | |
| Can be raised when converting string to some limited external encoding. Cannot be raised if converting to utf-*. | |