commentaires après
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4083 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
966c128bc9
commit
ef3d334d4a
|
@ -17,10 +17,6 @@
|
|||
(** {2 Lexer buffers} *)
|
||||
|
||||
|
||||
(** The type of lexer buffers. A lexer buffer is the argument passed
|
||||
to the scanning functions defined by the generated scanners.
|
||||
The lexer buffer holds the current state of the scanner, plus
|
||||
a function to refill the buffer from the input. *)
|
||||
type lexbuf =
|
||||
{ refill_buff : lexbuf -> unit;
|
||||
mutable lex_buffer : string;
|
||||
|
@ -30,27 +26,30 @@ type lexbuf =
|
|||
mutable lex_curr_pos : int;
|
||||
mutable lex_last_pos : int;
|
||||
mutable lex_last_action : int;
|
||||
mutable lex_eof_reached : bool;
|
||||
}
|
||||
mutable lex_eof_reached : bool }
|
||||
(** The type of lexer buffers. A lexer buffer is the argument passed
|
||||
to the scanning functions defined by the generated scanners.
|
||||
The lexer buffer holds the current state of the scanner, plus
|
||||
a function to refill the buffer from the input. *)
|
||||
|
||||
val from_channel : in_channel -> lexbuf
|
||||
(** Create a lexer buffer on the given input channel.
|
||||
[Lexing.from_channel inchan] returns a lexer buffer which reads
|
||||
from the input channel [inchan], at the current reading position. *)
|
||||
val from_channel : in_channel -> lexbuf
|
||||
|
||||
val from_string : string -> lexbuf
|
||||
(** Create a lexer buffer which reads from
|
||||
the given string. Reading starts from the first character in
|
||||
the string. An end-of-input condition is generated when the
|
||||
end of the string is reached. *)
|
||||
val from_string : string -> lexbuf
|
||||
|
||||
val from_function : (string -> int -> int) -> lexbuf
|
||||
(** Create a lexer buffer with the given function as its reading method.
|
||||
When the scanner needs more characters, it will call the given
|
||||
function, giving it a character string [s] and a character
|
||||
count [n]. The function should put [n] characters or less in [s],
|
||||
starting at character number 0, and return the number of characters
|
||||
provided. A return value of 0 means end of input. *)
|
||||
val from_function : (string -> int -> int) -> lexbuf
|
||||
|
||||
|
||||
(** {2 Functions for lexer semantic actions} *)
|
||||
|
@ -65,23 +64,23 @@ val from_function : (string -> int -> int) -> lexbuf
|
|||
[ocamllex], is bound to the lexer buffer passed to the parsing
|
||||
function. *)
|
||||
|
||||
val lexeme : lexbuf -> string
|
||||
(** [Lexing.lexeme lexbuf] returns the string matched by
|
||||
the regular expression. *)
|
||||
val lexeme : lexbuf -> string
|
||||
|
||||
val lexeme_char : lexbuf -> int -> char
|
||||
(** [Lexing.lexeme_char lexbuf i] returns character number [i] in
|
||||
the matched string. *)
|
||||
val lexeme_char : lexbuf -> int -> char
|
||||
|
||||
val lexeme_start : lexbuf -> int
|
||||
(** [Lexing.lexeme_start lexbuf] returns the position in the
|
||||
input stream of the first character of the matched string.
|
||||
The first character of the stream has position 0. *)
|
||||
val lexeme_start : lexbuf -> int
|
||||
|
||||
val lexeme_end : lexbuf -> int
|
||||
(** [Lexing.lexeme_end lexbuf] returns the position in the input stream
|
||||
of the character following the last character of the matched
|
||||
string. The first character of the stream has position 0. *)
|
||||
val lexeme_end : lexbuf -> int
|
||||
|
||||
(**/**)
|
||||
|
||||
|
@ -91,10 +90,10 @@ val lexeme_end : lexbuf -> int
|
|||
They are not intended to be used by user programs. *)
|
||||
|
||||
type lex_tables =
|
||||
{ lex_base: string;
|
||||
lex_backtrk: string;
|
||||
lex_default: string;
|
||||
lex_trans: string;
|
||||
lex_check: string }
|
||||
{ lex_base : string;
|
||||
lex_backtrk : string;
|
||||
lex_default : string;
|
||||
lex_trans : string;
|
||||
lex_check : string }
|
||||
|
||||
external engine: lex_tables -> int -> lexbuf -> int = "lex_engine"
|
||||
external engine : lex_tables -> int -> lexbuf -> int = "lex_engine"
|
||||
|
|
|
@ -25,216 +25,215 @@
|
|||
longer than about 10000 elements.
|
||||
*)
|
||||
|
||||
(** Return the length (number of elements) of the given list. *)
|
||||
val length : 'a list -> int
|
||||
(** Return the length (number of elements) of the given list. *)
|
||||
|
||||
val hd : 'a list -> 'a
|
||||
(** Return the first element of the given list. Raise
|
||||
[Failure "hd"] if the list is empty. *)
|
||||
val hd : 'a list -> 'a
|
||||
|
||||
val tl : 'a list -> 'a list
|
||||
(** Return the given list without its first element. Raise
|
||||
[Failure "tl"] if the list is empty. *)
|
||||
val tl : 'a list -> 'a list
|
||||
|
||||
val nth : 'a list -> int -> 'a
|
||||
(** Return the n-th element of the given list.
|
||||
The first element (head of the list) is at position 0.
|
||||
Raise [Failure "nth"] if the list is too short. *)
|
||||
val nth : 'a list -> int -> 'a
|
||||
|
||||
(** List reversal. *)
|
||||
val rev : 'a list -> 'a list
|
||||
(** List reversal. *)
|
||||
|
||||
val append : 'a list -> 'a list -> 'a list
|
||||
(** Catenate two lists. Same function as the infix operator [@].
|
||||
Not tail-recursive (length of the first argument). The [@]
|
||||
operator is not tail-recursive either. *)
|
||||
val append : 'a list -> 'a list -> 'a list
|
||||
|
||||
val rev_append : 'a list -> 'a list -> 'a list
|
||||
(** [List.rev_append l1 l2] reverses [l1] and catenates it to [l2].
|
||||
This is equivalent to {!List.rev}[ l1 @ l2], but [rev_append] is
|
||||
tail-recursive and more efficient. *)
|
||||
val rev_append : 'a list -> 'a list -> 'a list
|
||||
|
||||
val concat : 'a list list -> 'a list
|
||||
(** Concatenate a list of lists. Not tail-recursive
|
||||
(length of the argument + length of the longest sub-list). *)
|
||||
val concat : 'a list list -> 'a list
|
||||
|
||||
val flatten : 'a list list -> 'a list
|
||||
(** Flatten a list of lists. Not tail-recursive
|
||||
(length of the argument + length of the longest sub-list). *)
|
||||
val flatten : 'a list list -> 'a list
|
||||
|
||||
|
||||
(** {2 Iterators} *)
|
||||
|
||||
|
||||
val iter : ('a -> unit) -> 'a list -> unit
|
||||
(** [List.iter f [a1; ...; an]] applies function [f] in turn to
|
||||
[a1; ...; an]. It is equivalent to
|
||||
[begin f a1; f a2; ...; f an; () end]. *)
|
||||
val iter : ('a -> unit) -> 'a list -> unit
|
||||
|
||||
val map : ('a -> 'b) -> 'a list -> 'b list
|
||||
(** [List.map f [a1; ...; an]] applies function [f] to [a1, ..., an],
|
||||
and builds the list [[f a1; ...; f an]]
|
||||
with the results returned by [f]. Not tail-recursive. *)
|
||||
val map : ('a -> 'b) -> 'a list -> 'b list
|
||||
|
||||
val rev_map : ('a -> 'b) -> 'a list -> 'b list
|
||||
(** [List.rev_map f l] gives the same result as
|
||||
{!List.rev}[ (]{!List.map}[ f l)], but is tail-recursive and
|
||||
more efficient. *)
|
||||
val rev_map : ('a -> 'b) -> 'a list -> 'b list
|
||||
|
||||
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a
|
||||
(** [List.fold_left f a [b1; ...; bn]] is
|
||||
[f (... (f (f a b1) b2) ...) bn]. *)
|
||||
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a
|
||||
|
||||
val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
|
||||
(** [List.fold_right f [a1; ...; an] b] is
|
||||
[f a1 (f a2 (... (f an b) ...))]. Not tail-recursive. *)
|
||||
val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
|
||||
|
||||
|
||||
(** {2 Iterators on two lists} *)
|
||||
|
||||
|
||||
val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit
|
||||
(** [List.iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn
|
||||
[f a1 b1; ...; f an bn].
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. *)
|
||||
val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit
|
||||
|
||||
val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
(** [List.map2 f [a1; ...; an] [b1; ...; bn]] is
|
||||
[[f a1 b1; ...; f an bn]].
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. Not tail-recursive. *)
|
||||
val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
|
||||
val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
(** [List.rev_map2 f l] gives the same result as
|
||||
{!List.rev}[ (]{!List.map2}[ f l)], but is tail-recursive and
|
||||
more efficient. *)
|
||||
val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
|
||||
val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a
|
||||
(** [List.fold_left2 f a [b1; ...; bn] [c1; ...; cn]] is
|
||||
[f (... (f (f a b1 c1) b2 c2) ...) bn cn].
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. *)
|
||||
val fold_left2 :
|
||||
('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a
|
||||
|
||||
val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
|
||||
(** [List.fold_right2 f [a1; ...; an] [b1; ...; bn] c] is
|
||||
[f a1 b1 (f a2 b2 (... (f an bn c) ...))].
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. Not tail-recursive. *)
|
||||
val fold_right2 :
|
||||
('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
|
||||
|
||||
|
||||
(** {2 List scanning} *)
|
||||
|
||||
|
||||
val for_all : ('a -> bool) -> 'a list -> bool
|
||||
(** [for_all p [a1; ...; an]] checks if all elements of the list
|
||||
satisfy the predicate [p]. That is, it returns
|
||||
[(p a1) && (p a2) && ... && (p an)]. *)
|
||||
val for_all : ('a -> bool) -> 'a list -> bool
|
||||
|
||||
val exists : ('a -> bool) -> 'a list -> bool
|
||||
(** [exists p [a1; ...; an]] checks if at least one element of
|
||||
the list satisfies the predicate [p]. That is, it returns
|
||||
[(p a1) || (p a2) || ... || (p an)]. *)
|
||||
val exists : ('a -> bool) -> 'a list -> bool
|
||||
|
||||
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
(** Same as {!List.for_all}, but for a two-argument predicate.
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. *)
|
||||
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
|
||||
val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
(** Same as {!List.exists}, but for a two-argument predicate.
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. *)
|
||||
val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
|
||||
val mem : 'a -> 'a list -> bool
|
||||
(** [mem a l] is true if and only if [a] is equal
|
||||
to an element of [l]. *)
|
||||
val mem : 'a -> 'a list -> bool
|
||||
|
||||
val memq : 'a -> 'a list -> bool
|
||||
(** Same as {!List.mem}, but uses physical equality instead of structural
|
||||
equality to compare list elements. *)
|
||||
val memq : 'a -> 'a list -> bool
|
||||
|
||||
|
||||
(** {2 List searching} *)
|
||||
|
||||
|
||||
val find : ('a -> bool) -> 'a list -> 'a
|
||||
(** [find p l] returns the first element of the list [l]
|
||||
that satisfies the predicate [p].
|
||||
Raise [Not_found] if there is no value that satisfies [p] in the
|
||||
list [l]. *)
|
||||
val find : ('a -> bool) -> 'a list -> 'a
|
||||
|
||||
val filter : ('a -> bool) -> 'a list -> 'a list
|
||||
(** [filter p l] returns all the elements of the list [l]
|
||||
that satisfy the predicate [p]. The order of the elements
|
||||
in the input list is preserved. *)
|
||||
val filter : ('a -> bool) -> 'a list -> 'a list
|
||||
|
||||
(** [find_all] is another name for {!List.filter}. *)
|
||||
val find_all : ('a -> bool) -> 'a list -> 'a list
|
||||
(** [find_all] is another name for {!List.filter}. *)
|
||||
|
||||
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
|
||||
(** [partition p l] returns a pair of lists [(l1, l2)], where
|
||||
[l1] is the list of all the elements of [l] that
|
||||
satisfy the predicate [p], and [l2] is the list of all the
|
||||
elements of [l] that do not satisfy [p].
|
||||
The order of the elements in the input list is preserved. *)
|
||||
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
|
||||
|
||||
|
||||
(** {2 Association lists} *)
|
||||
|
||||
|
||||
val assoc : 'a -> ('a * 'b) list -> 'b
|
||||
(** [assoc a l] returns the value associated with key [a] in the list of
|
||||
pairs [l]. That is,
|
||||
[assoc a [ ...; (a,b); ...] = b]
|
||||
if [(a,b)] is the leftmost binding of [a] in list [l].
|
||||
Raise [Not_found] if there is no value associated with [a] in the
|
||||
list [l]. *)
|
||||
val assoc : 'a -> ('a * 'b) list -> 'b
|
||||
|
||||
val assq : 'a -> ('a * 'b) list -> 'b
|
||||
(** Same as {!List.assoc}, but uses physical equality instead of structural
|
||||
equality to compare keys. *)
|
||||
val assq : 'a -> ('a * 'b) list -> 'b
|
||||
|
||||
val mem_assoc : 'a -> ('a * 'b) list -> bool
|
||||
(** Same as {!List.assoc}, but simply return true if a binding exists,
|
||||
and false if no bindings exist for the given key. *)
|
||||
val mem_assoc : 'a -> ('a * 'b) list -> bool
|
||||
|
||||
val mem_assq : 'a -> ('a * 'b) list -> bool
|
||||
(** Same as {!List.mem_assoc}, but uses physical equality instead of
|
||||
structural equality to compare keys. *)
|
||||
val mem_assq : 'a -> ('a * 'b) list -> bool
|
||||
|
||||
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
(** [remove_assoc a l] returns the list of
|
||||
pairs [l] without the first pair with key [a], if any.
|
||||
Not tail-recursive. *)
|
||||
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
|
||||
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
(** Same as {!List.remove_assoc}, but uses physical equality instead
|
||||
of structural equality to compare keys. Not tail-recursive. *)
|
||||
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
|
||||
|
||||
(** {2 Lists of pairs} *)
|
||||
|
||||
|
||||
val split : ('a * 'b) list -> 'a list * 'b list
|
||||
(** Transform a list of pairs into a pair of lists:
|
||||
[split [(a1,b1); ...; (an,bn)]] is [([a1; ...; an], [b1; ...; bn])].
|
||||
Not tail-recursive.
|
||||
*)
|
||||
val split : ('a * 'b) list -> 'a list * 'b list
|
||||
|
||||
val combine : 'a list -> 'b list -> ('a * 'b) list
|
||||
(** Transform a pair of lists into a list of pairs:
|
||||
[combine [a1; ...; an] [b1; ...; bn]] is
|
||||
[[(a1,b1); ...; (an,bn)]].
|
||||
Raise [Invalid_argument] if the two lists
|
||||
have different lengths. Not tail-recursive. *)
|
||||
val combine : 'a list -> 'b list -> ('a * 'b) list
|
||||
|
||||
|
||||
(** {2 Sorting} *)
|
||||
|
||||
|
||||
val sort : ('a -> 'a -> int) -> 'a list -> 'a list
|
||||
(** Sort a list in increasing order according to a comparison
|
||||
function. The comparison function must return 0 if it arguments
|
||||
compare as equal, a positive integer if the first is greater,
|
||||
|
@ -248,12 +247,11 @@ val combine : 'a list -> 'b list -> ('a * 'b) list
|
|||
The current implementation uses Merge Sort and is the same as
|
||||
{!List.stable_sort}.
|
||||
*)
|
||||
val sort : ('a -> 'a -> int) -> 'a list -> 'a list;;
|
||||
|
||||
val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list
|
||||
(** Same as {!List.sort}, but the sorting algorithm is stable.
|
||||
|
||||
The current implementation is Merge Sort. It runs in constant
|
||||
heap space and logarithmic stack space.
|
||||
*)
|
||||
val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list;;
|
||||
|
||||
|
|
|
@ -26,104 +26,104 @@
|
|||
longer than about 10000 elements.
|
||||
*)
|
||||
|
||||
(** Return the length (number of elements) of the given list. *)
|
||||
val length : 'a list -> int
|
||||
(** Return the length (number of elements) of the given list. *)
|
||||
|
||||
val hd : 'a list -> 'a
|
||||
(** Return the first element of the given list. Raise
|
||||
[Failure "hd"] if the list is empty. *)
|
||||
val hd : 'a list -> 'a
|
||||
|
||||
val tl : 'a list -> 'a list
|
||||
(** Return the given list without its first element. Raise
|
||||
[Failure "tl"] if the list is empty. *)
|
||||
val tl : 'a list -> 'a list
|
||||
|
||||
val nth : 'a list -> int -> 'a
|
||||
(** Return the n-th element of the given list.
|
||||
The first element (head of the list) is at position 0.
|
||||
Raise [Failure "nth"] if the list is too short. *)
|
||||
val nth : 'a list -> int -> 'a
|
||||
|
||||
(** List reversal. *)
|
||||
val rev : 'a list -> 'a list
|
||||
(** List reversal. *)
|
||||
|
||||
val append : 'a list -> 'a list -> 'a list
|
||||
(** Catenate two lists. Same function as the infix operator [@].
|
||||
Not tail-recursive (length of the first argument). The [@]
|
||||
operator is not tail-recursive either. *)
|
||||
val append : 'a list -> 'a list -> 'a list
|
||||
|
||||
val rev_append : 'a list -> 'a list -> 'a list
|
||||
(** [List.rev_append l1 l2] reverses [l1] and catenates it to [l2].
|
||||
This is equivalent to {!ListLabels.rev}[ l1 @ l2], but [rev_append] is
|
||||
tail-recursive and more efficient. *)
|
||||
val rev_append : 'a list -> 'a list -> 'a list
|
||||
|
||||
val concat : 'a list list -> 'a list
|
||||
(** Concatenate a list of lists. Not tail-recursive
|
||||
(length of the argument + length of the longest sub-list). *)
|
||||
val concat : 'a list list -> 'a list
|
||||
|
||||
val flatten : 'a list list -> 'a list
|
||||
(** Flatten a list of lists. Not tail-recursive
|
||||
(length of the argument + length of the longest sub-list). *)
|
||||
val flatten : 'a list list -> 'a list
|
||||
|
||||
|
||||
(** {2 Iterators} *)
|
||||
|
||||
|
||||
val iter : f:('a -> unit) -> 'a list -> unit
|
||||
(** [List.iter f [a1; ...; an]] applies function [f] in turn to
|
||||
[a1; ...; an]. It is equivalent to
|
||||
[begin f a1; f a2; ...; f an; () end]. *)
|
||||
val iter : f:('a -> unit) -> 'a list -> unit
|
||||
|
||||
val map : f:('a -> 'b) -> 'a list -> 'b list
|
||||
(** [List.map f [a1; ...; an]] applies function [f] to [a1, ..., an],
|
||||
and builds the list [[f a1; ...; f an]]
|
||||
with the results returned by [f]. Not tail-recursive. *)
|
||||
val map : f:('a -> 'b) -> 'a list -> 'b list
|
||||
|
||||
val rev_map : f:('a -> 'b) -> 'a list -> 'b list
|
||||
(** [List.rev_map f l] gives the same result as
|
||||
{!ListLabels.rev}[ (]{!ListLabels.map}[ f l)], but is tail-recursive and
|
||||
more efficient. *)
|
||||
val rev_map : f:('a -> 'b) -> 'a list -> 'b list
|
||||
|
||||
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b list -> 'a
|
||||
(** [List.fold_left f a [b1; ...; bn]] is
|
||||
[f (... (f (f a b1) b2) ...) bn]. *)
|
||||
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b list -> 'a
|
||||
|
||||
val fold_right : f:('a -> 'b -> 'b) -> 'a list -> init:'b -> 'b
|
||||
(** [List.fold_right f [a1; ...; an] b] is
|
||||
[f a1 (f a2 (... (f an b) ...))]. Not tail-recursive. *)
|
||||
val fold_right : f:('a -> 'b -> 'b) -> 'a list -> init:'b -> 'b
|
||||
|
||||
|
||||
(** {2 Iterators on two lists} *)
|
||||
|
||||
|
||||
val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit
|
||||
(** [List.iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn
|
||||
[f a1 b1; ...; f an bn].
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. *)
|
||||
val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit
|
||||
|
||||
val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
(** [List.map2 f [a1; ...; an] [b1; ...; bn]] is
|
||||
[[f a1 b1; ...; f an bn]].
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. Not tail-recursive. *)
|
||||
val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
|
||||
val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
(** [List.rev_map2 f l] gives the same result as
|
||||
{!ListLabels.rev}[ (]{!ListLabels.map2}[ f l)], but is tail-recursive and
|
||||
more efficient. *)
|
||||
val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
|
||||
val fold_left2 :
|
||||
f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a
|
||||
(** [List.fold_left2 f a [b1; ...; bn] [c1; ...; cn]] is
|
||||
[f (... (f (f a b1 c1) b2 c2) ...) bn cn].
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. *)
|
||||
val fold_left2 :
|
||||
f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a
|
||||
|
||||
val fold_right2 :
|
||||
f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c
|
||||
(** [List.fold_right2 f [a1; ...; an] [b1; ...; bn] c] is
|
||||
[f a1 b1 (f a2 b2 (... (f an bn c) ...))].
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. Not tail-recursive. *)
|
||||
val fold_right2 :
|
||||
f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c
|
||||
|
||||
|
||||
|
||||
|
@ -131,33 +131,33 @@ val fold_right2 :
|
|||
(** {2 List scanning} *)
|
||||
|
||||
|
||||
val for_all : f:('a -> bool) -> 'a list -> bool
|
||||
(** [for_all p [a1; ...; an]] checks if all elements of the list
|
||||
satisfy the predicate [p]. That is, it returns
|
||||
[(p a1) && (p a2) && ... && (p an)]. *)
|
||||
val for_all : f:('a -> bool) -> 'a list -> bool
|
||||
|
||||
val exists : f:('a -> bool) -> 'a list -> bool
|
||||
(** [exists p [a1; ...; an]] checks if at least one element of
|
||||
the list satisfies the predicate [p]. That is, it returns
|
||||
[(p a1) || (p a2) || ... || (p an)]. *)
|
||||
val exists : f:('a -> bool) -> 'a list -> bool
|
||||
|
||||
val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
(** Same as {!ListLabels.for_all}, but for a two-argument predicate.
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. *)
|
||||
val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
|
||||
val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
(** Same as {!ListLabels.exists}, but for a two-argument predicate.
|
||||
Raise [Invalid_argument] if the two lists have
|
||||
different lengths. *)
|
||||
val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
|
||||
val mem : 'a -> set:'a list -> bool
|
||||
(** [mem a l] is true if and only if [a] is equal
|
||||
to an element of [l]. *)
|
||||
val mem : 'a -> set:'a list -> bool
|
||||
|
||||
val memq : 'a -> set:'a list -> bool
|
||||
(** Same as {!ListLabels.mem}, but uses physical equality instead of structural
|
||||
equality to compare list elements. *)
|
||||
val memq : 'a -> set:'a list -> bool
|
||||
|
||||
|
||||
|
||||
|
@ -165,26 +165,26 @@ val memq : 'a -> set:'a list -> bool
|
|||
(** {2 List searching} *)
|
||||
|
||||
|
||||
val find : f:('a -> bool) -> 'a list -> 'a
|
||||
(** [find p l] returns the first element of the list [l]
|
||||
that satisfies the predicate [p].
|
||||
Raise [Not_found] if there is no value that satisfies [p] in the
|
||||
list [l]. *)
|
||||
val find : f:('a -> bool) -> 'a list -> 'a
|
||||
|
||||
val filter : f:('a -> bool) -> 'a list -> 'a list
|
||||
(** [filter p l] returns all the elements of the list [l]
|
||||
that satisfy the predicate [p]. The order of the elements
|
||||
in the input list is preserved. *)
|
||||
val filter : f:('a -> bool) -> 'a list -> 'a list
|
||||
|
||||
(** [find_all] is another name for {!ListLabels.filter}. *)
|
||||
val find_all : f:('a -> bool) -> 'a list -> 'a list
|
||||
(** [find_all] is another name for {!ListLabels.filter}. *)
|
||||
|
||||
val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list
|
||||
(** [partition p l] returns a pair of lists [(l1, l2)], where
|
||||
[l1] is the list of all the elements of [l] that
|
||||
satisfy the predicate [p], and [l2] is the list of all the
|
||||
elements of [l] that do not satisfy [p].
|
||||
The order of the elements in the input list is preserved. *)
|
||||
val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list
|
||||
|
||||
|
||||
|
||||
|
@ -192,34 +192,34 @@ val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list
|
|||
(** {2 Association lists} *)
|
||||
|
||||
|
||||
val assoc : 'a -> ('a * 'b) list -> 'b
|
||||
(** [assoc a l] returns the value associated with key [a] in the list of
|
||||
pairs [l]. That is,
|
||||
[assoc a [ ...; (a,b); ...] = b]
|
||||
if [(a,b)] is the leftmost binding of [a] in list [l].
|
||||
Raise [Not_found] if there is no value associated with [a] in the
|
||||
list [l]. *)
|
||||
val assoc : 'a -> ('a * 'b) list -> 'b
|
||||
|
||||
val assq : 'a -> ('a * 'b) list -> 'b
|
||||
(** Same as {!ListLabels.assoc}, but uses physical equality instead of structural
|
||||
equality to compare keys. *)
|
||||
val assq : 'a -> ('a * 'b) list -> 'b
|
||||
|
||||
val mem_assoc : 'a -> map:('a * 'b) list -> bool
|
||||
(** Same as {!ListLabels.assoc}, but simply return true if a binding exists,
|
||||
and false if no bindings exist for the given key. *)
|
||||
val mem_assoc : 'a -> map:('a * 'b) list -> bool
|
||||
|
||||
val mem_assq : 'a -> map:('a * 'b) list -> bool
|
||||
(** Same as {!ListLabels.mem_assoc}, but uses physical equality instead of
|
||||
structural equality to compare keys. *)
|
||||
val mem_assq : 'a -> map:('a * 'b) list -> bool
|
||||
|
||||
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
(** [remove_assoc a l] returns the list of
|
||||
pairs [l] without the first pair with key [a], if any.
|
||||
Not tail-recursive. *)
|
||||
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
|
||||
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
(** Same as {!ListLabels.remove_assq}, but uses physical equality instead
|
||||
of structural equality to compare keys. Not tail-recursive. *)
|
||||
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
|
||||
|
||||
|
||||
|
@ -227,24 +227,25 @@ val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
|
|||
(** {2 Lists of pairs} *)
|
||||
|
||||
|
||||
val split : ('a * 'b) list -> 'a list * 'b list
|
||||
(** Transform a list of pairs into a pair of lists:
|
||||
[split [(a1,b1); ...; (an,bn)]] is [([a1; ...; an], [b1; ...; bn])].
|
||||
Not tail-recursive.
|
||||
*)
|
||||
val split : ('a * 'b) list -> 'a list * 'b list
|
||||
|
||||
val combine : 'a list -> 'b list -> ('a * 'b) list
|
||||
(** Transform a pair of lists into a list of pairs:
|
||||
[combine [a1; ...; an] [b1; ...; bn]] is
|
||||
[[(a1,b1); ...; (an,bn)]].
|
||||
Raise [Invalid_argument] if the two lists
|
||||
have different lengths. Not tail-recursive. *)
|
||||
val combine : 'a list -> 'b list -> ('a * 'b) list
|
||||
|
||||
|
||||
|
||||
(** {2 Sorting} *)
|
||||
|
||||
|
||||
val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
|
||||
(** Sort a list in increasing order according to a comparison
|
||||
function. The comparison function must return 0 if it arguments
|
||||
compare as equal, a positive integer if the first is greater,
|
||||
|
@ -258,12 +259,11 @@ val combine : 'a list -> 'b list -> ('a * 'b) list
|
|||
The current implementation uses Merge Sort and is the same as
|
||||
{!ListLabels.stable_sort}.
|
||||
*)
|
||||
val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list;;
|
||||
|
||||
val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
|
||||
(** Same as {!ListLabels.sort}, but the sorting algorithm is stable.
|
||||
|
||||
The current implementation is Merge Sort. It runs in constant
|
||||
heap space and logarithmic stack space.
|
||||
*)
|
||||
val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list;;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
and insertion take time logarithmic in the size of the map.
|
||||
*)
|
||||
|
||||
module type OrderedType = sig type t val compare : t -> t -> int end
|
||||
(** The input signature of the functor [Map.Make].
|
||||
[t] is the type of the map keys.
|
||||
[compare] is a total ordering function over the keys.
|
||||
|
@ -31,68 +32,24 @@
|
|||
and [f e1 e2] is strictly positive if [e1] is greater than [e2].
|
||||
Example: a suitable ordering function is
|
||||
the generic structural comparison function {!Pervasives.compare}. *)
|
||||
module type OrderedType =
|
||||
sig
|
||||
type t
|
||||
val compare: t -> t -> int
|
||||
end
|
||||
|
||||
|
||||
module type S =
|
||||
sig
|
||||
(** The type of the map keys. *)
|
||||
type key
|
||||
|
||||
(** The type of maps from type [key] to type ['a]. *)
|
||||
type (+'a) t
|
||||
|
||||
(** The empty map. *)
|
||||
val empty: 'a t
|
||||
|
||||
(** [add x y m] returns a map containing the same bindings as
|
||||
[m], plus a binding of [x] to [y]. If [x] was already bound
|
||||
in [m], its previous binding disappears. *)
|
||||
val add: key -> 'a -> 'a t -> 'a t
|
||||
|
||||
(** [find x m] returns the current binding of [x] in [m],
|
||||
or raises [Not_found] if no such binding exists. *)
|
||||
val find: key -> 'a t -> 'a
|
||||
|
||||
(** [remove x m] returns a map containing the same bindings as
|
||||
[m], except for [x] which is unbound in the returned map. *)
|
||||
val remove: key -> 'a t -> 'a t
|
||||
|
||||
(** [mem x m] returns [true] if [m] contains a binding for [x],
|
||||
and [false] otherwise. *)
|
||||
val mem: key -> 'a t -> bool
|
||||
|
||||
(** [iter f m] applies [f] to all bindings in map [m].
|
||||
[f] receives the key as first argument, and the associated value
|
||||
as second argument. The order in which the bindings are passed to
|
||||
[f] is unspecified. Only current bindings are presented to [f]:
|
||||
bindings hidden by more recent bindings are not passed to [f]. *)
|
||||
val iter: (key -> 'a -> unit) -> 'a t -> unit
|
||||
|
||||
(** [map f m] returns a map with same domain as [m], where the
|
||||
associated value [a] of all bindings of [m] has been
|
||||
replaced by the result of the application of [f] to [a].
|
||||
The order in which the associated values are passed to [f]
|
||||
is unspecified. *)
|
||||
val map: ('a -> 'b) -> 'a t -> 'b t
|
||||
|
||||
(** Same as {!Map.S.map}, but the function receives as arguments both the
|
||||
key and the associated value for each binding of the map. *)
|
||||
val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t
|
||||
|
||||
(** [fold f m a] computes [(f kN dN ... (f k1 d1 a)...)],
|
||||
where [k1 ... kN] are the keys of all bindings in [m],
|
||||
and [d1 ... dN] are the associated data.
|
||||
The order in which the bindings are presented to [f] is
|
||||
unspecified. *)
|
||||
val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
|
||||
type 'a t
|
||||
val empty : 'a t
|
||||
val add : key -> 'a -> 'a t -> 'a t
|
||||
val find : key -> 'a t -> 'a
|
||||
val remove : key -> 'a t -> 'a t
|
||||
val mem : key -> 'a t -> bool
|
||||
val iter : (key -> 'a -> unit) -> 'a t -> unit
|
||||
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
|
||||
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
|
||||
end
|
||||
|
||||
module Make (Ord : OrderedType) : S with type key = Ord.t
|
||||
(** Functor building an implementation of the map structure
|
||||
given a totally ordered type. *)
|
||||
module Make (Ord : OrderedType): (S with type key = Ord.t)
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@
|
|||
differently than binary channels, e.g. Windows.
|
||||
*)
|
||||
|
||||
(** The flags to the [Marshal.to_*] functions below. *)
|
||||
type extern_flags =
|
||||
No_sharing (** Don't preserve sharing *)
|
||||
| Closures (** Send function closures *)
|
||||
(** The flags to the [Marshal.to_*] functions below. *)
|
||||
|
||||
val to_channel : out_channel -> 'a -> extern_flags list -> unit
|
||||
(** [Marshal.to_channel chan v flags] writes the representation
|
||||
of [v] on channel [chan]. The [flags] argument is a
|
||||
possibly empty list of flags that governs the marshaling
|
||||
|
@ -76,15 +77,15 @@ type extern_flags =
|
|||
with exactly the same compiled code. (This is checked
|
||||
at un-marshaling time, using an MD5 digest of the code
|
||||
transmitted along with the code position.) *)
|
||||
val to_channel: out_channel -> 'a -> extern_flags list -> unit
|
||||
|
||||
external to_string :
|
||||
'a -> extern_flags list -> string = "output_value_to_string"
|
||||
(** [Marshal.to_string v flags] returns a string containing
|
||||
the representation of [v] as a sequence of bytes.
|
||||
The [flags] argument has the same meaning as for
|
||||
{!Marshal.to_channel}. *)
|
||||
external to_string: 'a -> extern_flags list -> string
|
||||
= "output_value_to_string"
|
||||
|
||||
val to_buffer : string -> int -> int -> 'a -> extern_flags list -> int
|
||||
(** [Marshal.to_buffer buff ofs len v flags] marshals the value [v],
|
||||
storing its byte representation in the string [buff],
|
||||
starting at character number [ofs], and writing at most
|
||||
|
@ -92,20 +93,20 @@ external to_string: 'a -> extern_flags list -> string
|
|||
actually written to the string. If the byte representation
|
||||
of [v] does not fit in [len] characters, the exception [Failure]
|
||||
is raised. *)
|
||||
val to_buffer: string -> int -> int -> 'a -> extern_flags list -> int
|
||||
|
||||
val from_channel : in_channel -> 'a
|
||||
(** [Marshal.from_channel chan] reads from channel [chan] the
|
||||
byte representation of a structured value, as produced by
|
||||
one of the [Marshal.to_*] functions, and reconstructs and
|
||||
returns the corresponding value.*)
|
||||
val from_channel: in_channel -> 'a
|
||||
|
||||
val from_string : string -> int -> 'a
|
||||
(** [Marshal.from_string buff ofs] unmarshals a structured value
|
||||
like {!Marshal.from_channel} does, except that the byte
|
||||
representation is not read from a channel, but taken from
|
||||
the string [buff], starting at position [ofs]. *)
|
||||
val from_string: string -> int -> 'a
|
||||
|
||||
val header_size : int
|
||||
(** The bytes representing a marshaled value are composed of
|
||||
a fixed-size header and a variable-sized data part,
|
||||
whose size can be determined from the header.
|
||||
|
@ -126,12 +127,11 @@ val from_string: string -> int -> 'a
|
|||
make sure the buffer is large enough to hold the remaining
|
||||
data, then read it, and finally call {!Marshal.from_string}
|
||||
to unmarshal the value. *)
|
||||
val header_size : int
|
||||
|
||||
(** See {!Marshal.header_size}.*)
|
||||
val data_size : string -> int -> int
|
||||
|
||||
(** See {!Marshal.header_size}.*)
|
||||
|
||||
val total_size : string -> int -> int
|
||||
(** See {!Marshal.header_size}.*)
|
||||
|
||||
|
||||
|
|
|
@ -22,95 +22,90 @@
|
|||
preferable to avoid them in new projects.
|
||||
*)
|
||||
|
||||
module Hashtbl : sig
|
||||
type ('a, 'b) t = ('a, 'b) Hashtbl.t
|
||||
val create : int -> ('a, 'b) t
|
||||
val clear : ('a, 'b) t -> unit
|
||||
val add : ('a, 'b) t -> key:'a -> data:'b -> unit
|
||||
val find : ('a, 'b) t -> 'a -> 'b
|
||||
val find_all : ('a, 'b) t -> 'a -> 'b list
|
||||
val mem : ('a, 'b) t -> 'a -> bool
|
||||
val remove : ('a, 'b) t -> 'a -> unit
|
||||
val replace : ('a, 'b) t -> key:'a -> data:'b -> unit
|
||||
val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit
|
||||
val fold :
|
||||
f:(key:'a -> data:'b -> 'c -> 'c) ->
|
||||
('a, 'b) t -> init:'c -> 'c
|
||||
module type HashedType = Hashtbl.HashedType
|
||||
module type S =
|
||||
sig
|
||||
type key
|
||||
and 'a t
|
||||
val create : int -> 'a t
|
||||
val clear : 'a t -> unit
|
||||
val copy: 'a t -> 'a t
|
||||
val add : 'a t -> key:key -> data:'a -> unit
|
||||
val remove : 'a t -> key -> unit
|
||||
val find : 'a t -> key -> 'a
|
||||
val find_all : 'a t -> key -> 'a list
|
||||
val replace : 'a t -> key:key -> data:'a -> unit
|
||||
val mem : 'a t -> key -> bool
|
||||
val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
|
||||
val fold :
|
||||
f:(key:key -> data:'a -> 'b -> 'b) ->
|
||||
'a t -> init:'b -> 'b
|
||||
end
|
||||
module Make : functor (H : HashedType) -> S with type key = H.t
|
||||
val hash : 'a -> int
|
||||
external hash_param : int -> int -> 'a -> int
|
||||
= "hash_univ_param" "noalloc"
|
||||
end
|
||||
module Hashtbl :
|
||||
sig
|
||||
type ('a, 'b) t = ('a, 'b) Hashtbl.t
|
||||
val create : int -> ('a, 'b) t
|
||||
val clear : ('a, 'b) t -> unit
|
||||
val add : ('a, 'b) t -> key:'a -> data:'b -> unit
|
||||
val find : ('a, 'b) t -> 'a -> 'b
|
||||
val find_all : ('a, 'b) t -> 'a -> 'b list
|
||||
val mem : ('a, 'b) t -> 'a -> bool
|
||||
val remove : ('a, 'b) t -> 'a -> unit
|
||||
val replace : ('a, 'b) t -> key:'a -> data:'b -> unit
|
||||
val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit
|
||||
val fold :
|
||||
f:(key:'a -> data:'b -> 'c -> 'c) -> ('a, 'b) t -> init:'c -> 'c
|
||||
module type HashedType = Hashtbl.HashedType
|
||||
module type S =
|
||||
sig
|
||||
type key and 'a t
|
||||
val create : int -> 'a t
|
||||
val clear : 'a t -> unit
|
||||
val copy : 'a t -> 'a t
|
||||
val add : 'a t -> key:key -> data:'a -> unit
|
||||
val remove : 'a t -> key -> unit
|
||||
val find : 'a t -> key -> 'a
|
||||
val find_all : 'a t -> key -> 'a list
|
||||
val replace : 'a t -> key:key -> data:'a -> unit
|
||||
val mem : 'a t -> key -> bool
|
||||
val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
|
||||
val fold : f:(key:key -> data:'a -> 'b -> 'b) -> 'a t -> init:'b -> 'b
|
||||
end
|
||||
module Make (H : HashedType) : S with type key = H.t
|
||||
val hash : 'a -> int
|
||||
external hash_param :
|
||||
int -> int -> 'a -> int = "hash_univ_param" "noalloc"
|
||||
end
|
||||
|
||||
module Map : sig
|
||||
module type OrderedType = Map.OrderedType
|
||||
module type S =
|
||||
sig
|
||||
type key
|
||||
and (+'a) t
|
||||
val empty : 'a t
|
||||
val add : key:key -> data:'a -> 'a t -> 'a t
|
||||
val find : key -> 'a t -> 'a
|
||||
val remove : key -> 'a t -> 'a t
|
||||
val mem : key -> 'a t -> bool
|
||||
val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
|
||||
val map : f:('a -> 'b) -> 'a t -> 'b t
|
||||
val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t
|
||||
val fold :
|
||||
f:(key:key -> data:'a -> 'b -> 'b) ->
|
||||
'a t -> init:'b -> 'b
|
||||
end
|
||||
module Make : functor (Ord : OrderedType) -> S with type key = Ord.t
|
||||
end
|
||||
module Map :
|
||||
sig
|
||||
module type OrderedType = Map.OrderedType
|
||||
module type S =
|
||||
sig
|
||||
type key and 'a t
|
||||
val empty : 'a t
|
||||
val add : key:key -> data:'a -> 'a t -> 'a t
|
||||
val find : key -> 'a t -> 'a
|
||||
val remove : key -> 'a t -> 'a t
|
||||
val mem : key -> 'a t -> bool
|
||||
val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
|
||||
val map : f:('a -> 'b) -> 'a t -> 'b t
|
||||
val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t
|
||||
val fold : f:(key:key -> data:'a -> 'b -> 'b) -> 'a t -> init:'b -> 'b
|
||||
end
|
||||
module Make (Ord : OrderedType) : S with type key = Ord.t
|
||||
end
|
||||
|
||||
module Set : sig
|
||||
module type OrderedType = Set.OrderedType
|
||||
module type S =
|
||||
sig
|
||||
type elt
|
||||
and t
|
||||
val empty : t
|
||||
val is_empty : t -> bool
|
||||
val mem : elt -> t -> bool
|
||||
val add : elt -> t -> t
|
||||
val singleton : elt -> t
|
||||
val remove : elt -> t -> t
|
||||
val union : t -> t -> t
|
||||
val inter : t -> t -> t
|
||||
val diff : t -> t -> t
|
||||
val compare : t -> t -> int
|
||||
val equal : t -> t -> bool
|
||||
val subset : t -> t -> bool
|
||||
val iter : f:(elt -> unit) -> t -> unit
|
||||
val fold : f:(elt -> 'a -> 'a) -> t -> init:'a -> 'a
|
||||
val for_all : f:(elt -> bool) -> t -> bool
|
||||
val exists : f:(elt -> bool) -> t -> bool
|
||||
val filter : f:(elt -> bool) -> t -> t
|
||||
val partition : f:(elt -> bool) -> t -> t * t
|
||||
val cardinal : t -> int
|
||||
val elements : t -> elt list
|
||||
val min_elt : t -> elt
|
||||
val max_elt : t -> elt
|
||||
val choose : t -> elt
|
||||
end
|
||||
module Make : functor (Ord : OrderedType) -> S with type elt = Ord.t
|
||||
end
|
||||
module Set :
|
||||
sig
|
||||
module type OrderedType = Set.OrderedType
|
||||
module type S =
|
||||
sig
|
||||
type elt and t
|
||||
val empty : t
|
||||
val is_empty : t -> bool
|
||||
val mem : elt -> t -> bool
|
||||
val add : elt -> t -> t
|
||||
val singleton : elt -> t
|
||||
val remove : elt -> t -> t
|
||||
val union : t -> t -> t
|
||||
val inter : t -> t -> t
|
||||
val diff : t -> t -> t
|
||||
val compare : t -> t -> int
|
||||
val equal : t -> t -> bool
|
||||
val subset : t -> t -> bool
|
||||
val iter : f:(elt -> unit) -> t -> unit
|
||||
val fold : f:(elt -> 'a -> 'a) -> t -> init:'a -> 'a
|
||||
val for_all : f:(elt -> bool) -> t -> bool
|
||||
val exists : f:(elt -> bool) -> t -> bool
|
||||
val filter : f:(elt -> bool) -> t -> t
|
||||
val partition : f:(elt -> bool) -> t -> t * t
|
||||
val cardinal : t -> int
|
||||
val elements : t -> elt list
|
||||
val min_elt : t -> elt
|
||||
val max_elt : t -> elt
|
||||
val choose : t -> elt
|
||||
end
|
||||
module Make (Ord : OrderedType) : S with type elt = Ord.t
|
||||
end
|
||||
|
|
|
@ -29,31 +29,32 @@
|
|||
over the [int] type.
|
||||
*)
|
||||
|
||||
val zero : nativeint
|
||||
(** The native integer 0.*)
|
||||
val zero: nativeint
|
||||
|
||||
val one : nativeint
|
||||
(** The native integer 1.*)
|
||||
val one: nativeint
|
||||
|
||||
val minus_one : nativeint
|
||||
(** The native integer -1.*)
|
||||
val minus_one: nativeint
|
||||
|
||||
external neg : nativeint -> nativeint = "%nativeint_neg"
|
||||
(** Unary negation. *)
|
||||
external neg: nativeint -> nativeint = "%nativeint_neg"
|
||||
|
||||
external add : nativeint -> nativeint -> nativeint = "%nativeint_add"
|
||||
(** Addition. *)
|
||||
external add: nativeint -> nativeint -> nativeint = "%nativeint_add"
|
||||
|
||||
external sub : nativeint -> nativeint -> nativeint = "%nativeint_sub"
|
||||
(** Subtraction. *)
|
||||
external sub: nativeint -> nativeint -> nativeint = "%nativeint_sub"
|
||||
|
||||
external mul : nativeint -> nativeint -> nativeint = "%nativeint_mul"
|
||||
(** Multiplication. *)
|
||||
external mul: nativeint -> nativeint -> nativeint = "%nativeint_mul"
|
||||
|
||||
external div : nativeint -> nativeint -> nativeint = "%nativeint_div"
|
||||
(** Integer division. Raise [Division_by_zero] if the second
|
||||
argument is zero. *)
|
||||
external div: nativeint -> nativeint -> nativeint = "%nativeint_div"
|
||||
|
||||
external rem : nativeint -> nativeint -> nativeint = "%nativeint_mod"
|
||||
(** Integer remainder. If [x >= 0] and [y > 0], the result
|
||||
of [Nativeint.rem x y] satisfies the following properties:
|
||||
[0 <= Nativeint.rem x y < y] and
|
||||
|
@ -61,112 +62,112 @@ external div: nativeint -> nativeint -> nativeint = "%nativeint_div"
|
|||
If [y = 0], [Nativeint.rem x y] raises [Division_by_zero].
|
||||
If [x < 0] or [y < 0], the result of [Nativeint.rem x y] is
|
||||
not specified and depends on the platform. *)
|
||||
external rem: nativeint -> nativeint -> nativeint = "%nativeint_mod"
|
||||
|
||||
val succ : nativeint -> nativeint
|
||||
(** Successor.
|
||||
[Nativeint.succ x] is [Nativeint.add x Nativeint.one]. *)
|
||||
val succ: nativeint -> nativeint
|
||||
|
||||
val pred : nativeint -> nativeint
|
||||
(** Predecessor.
|
||||
[Nativeint.pred x] is [Nativeint.sub x Nativeint.one]. *)
|
||||
val pred: nativeint -> nativeint
|
||||
|
||||
val abs : nativeint -> nativeint
|
||||
(** Return the absolute value of its argument. *)
|
||||
val abs: nativeint -> nativeint
|
||||
|
||||
val size : int
|
||||
(** The size in bits of a native integer. This is equal to [32]
|
||||
on a 32-bit platform and to [64] on a 64-bit platform. *)
|
||||
val size: int
|
||||
|
||||
val max_int : nativeint
|
||||
(** The greatest representable native integer,
|
||||
either 2{^31} - 1 on a 32-bit platform,
|
||||
or 2{^63} - 1 on a 64-bit platform. *)
|
||||
val max_int: nativeint
|
||||
|
||||
val min_int : nativeint
|
||||
(** The greatest representable native integer,
|
||||
either -2{^31} on a 32-bit platform,
|
||||
or -2{^63} on a 64-bit platform. *)
|
||||
val min_int: nativeint
|
||||
|
||||
external logand : nativeint -> nativeint -> nativeint = "%nativeint_and"
|
||||
(** Bitwise logical and. *)
|
||||
external logand: nativeint -> nativeint -> nativeint = "%nativeint_and"
|
||||
|
||||
external logor : nativeint -> nativeint -> nativeint = "%nativeint_or"
|
||||
(** Bitwise logical or. *)
|
||||
external logor: nativeint -> nativeint -> nativeint = "%nativeint_or"
|
||||
|
||||
external logxor : nativeint -> nativeint -> nativeint = "%nativeint_xor"
|
||||
(** Bitwise logical exclusive or. *)
|
||||
external logxor: nativeint -> nativeint -> nativeint = "%nativeint_xor"
|
||||
|
||||
val lognot : nativeint -> nativeint
|
||||
(** Bitwise logical negation *)
|
||||
val lognot: nativeint -> nativeint
|
||||
|
||||
external shift_left : nativeint -> int -> nativeint = "%nativeint_lsl"
|
||||
(** [Nativeint.shift_left x y] shifts [x] to the left by [y] bits.
|
||||
The result is unspecified if [y < 0] or [y >= bitsize],
|
||||
where [bitsize] is [32] on a 32-bit platform and
|
||||
[64] on a 64-bit platform. *)
|
||||
external shift_left: nativeint -> int -> nativeint = "%nativeint_lsl"
|
||||
|
||||
external shift_right : nativeint -> int -> nativeint = "%nativeint_asr"
|
||||
(** [Nativeint.shift_right x y] shifts [x] to the right by [y] bits.
|
||||
This is an arithmetic shift: the sign bit of [x] is replicated
|
||||
and inserted in the vacated bits.
|
||||
The result is unspecified if [y < 0] or [y >= bitsize]. *)
|
||||
external shift_right: nativeint -> int -> nativeint = "%nativeint_asr"
|
||||
|
||||
external shift_right_logical :
|
||||
nativeint -> int -> nativeint = "%nativeint_lsr"
|
||||
(** [Nativeint.shift_right_logical x y] shifts [x] to the right
|
||||
by [y] bits.
|
||||
This is a logical shift: zeroes are inserted in the vacated bits
|
||||
regardless of the sign of [x].
|
||||
The result is unspecified if [y < 0] or [y >= bitsize]. *)
|
||||
external shift_right_logical: nativeint -> int -> nativeint = "%nativeint_lsr"
|
||||
|
||||
|
||||
external of_int : int -> nativeint = "%nativeint_of_int"
|
||||
(** Convert the given integer (type [int]) to a native integer
|
||||
(type [nativeint]). *)
|
||||
external of_int: int -> nativeint = "%nativeint_of_int"
|
||||
|
||||
external to_int : nativeint -> int = "%nativeint_to_int"
|
||||
(** Convert the given native integer (type [nativeint]) to an
|
||||
integer (type [int]). The high-order bit is lost during
|
||||
the conversion. *)
|
||||
external to_int: nativeint -> int = "%nativeint_to_int"
|
||||
|
||||
external of_float : float -> nativeint = "nativeint_of_float"
|
||||
(** Convert the given floating-point number to a native integer,
|
||||
discarding the fractional part (truncate towards 0).
|
||||
The result of the conversion is undefined if, after truncation,
|
||||
the number is outside the range
|
||||
\[{!Nativeint.min_int}, {!Nativeint.max_int}\]. *)
|
||||
external of_float : float -> nativeint = "nativeint_of_float"
|
||||
|
||||
(** Convert the given native integer to a floating-point number. *)
|
||||
external to_float : nativeint -> float = "nativeint_to_float"
|
||||
(** Convert the given native integer to a floating-point number. *)
|
||||
|
||||
external of_int32 : int32 -> nativeint = "%nativeint_of_int32"
|
||||
(** Convert the given 32-bit integer (type [int32])
|
||||
to a native integer. *)
|
||||
external of_int32: int32 -> nativeint = "%nativeint_of_int32"
|
||||
|
||||
external to_int32 : nativeint -> int32 = "%nativeint_to_int32"
|
||||
(** Convert the given native integer to a
|
||||
32-bit integer (type [int32]). On 64-bit platforms,
|
||||
the 64-bit native integer is taken modulo 2{^32},
|
||||
i.e. the top 32 bits are lost. On 32-bit platforms,
|
||||
the conversion is exact. *)
|
||||
external to_int32: nativeint -> int32 = "%nativeint_to_int32"
|
||||
|
||||
external of_string : string -> nativeint = "nativeint_of_string"
|
||||
(** Convert the given string to a native 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. *)
|
||||
external of_string: string -> nativeint = "nativeint_of_string"
|
||||
|
||||
val to_string : nativeint -> string
|
||||
(** Return the string representation of its argument, in decimal. *)
|
||||
val to_string: nativeint -> string
|
||||
|
||||
external format : string -> nativeint -> string = "nativeint_format"
|
||||
(** [Nativeint.format fmt n] return the string representation of the
|
||||
native integer [n] in the format specified by [fmt].
|
||||
[fmt] is a [Printf]-style format containing exactly
|
||||
one [%d], [%i], [%u], [%x], [%X] or [%o] conversion specification.
|
||||
This function is deprecated; use {!Printf.sprintf} with a [%nx] format
|
||||
instead. *)
|
||||
external format : string -> nativeint -> string = "nativeint_format"
|
||||
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
(** Object-oriented extension *)
|
||||
|
||||
val copy : (< .. > as 'a) -> 'a
|
||||
(** [Oo.copy o] returns a copy of object [o], that is a fresh
|
||||
object with the same methods and instance variables as [o] *)
|
||||
val copy : (< .. > as 'a) -> 'a
|
||||
|
||||
|
||||
(**/**)
|
||||
|
@ -26,7 +26,7 @@ val copy : (< .. > as 'a) -> 'a
|
|||
(** {2 Methods} *)
|
||||
|
||||
type label
|
||||
val new_method: string -> label
|
||||
val new_method : string -> label
|
||||
|
||||
(** {2 Classes} *)
|
||||
|
||||
|
@ -34,39 +34,44 @@ type table
|
|||
type meth
|
||||
type t
|
||||
type obj
|
||||
val new_variable: table -> string -> int
|
||||
val get_variable: table -> string -> int
|
||||
val get_method_label: table -> string -> label
|
||||
val get_method: table -> label -> meth
|
||||
val set_method: table -> label -> meth -> unit
|
||||
val narrow: table -> string list -> string list -> string list -> unit
|
||||
val widen: table -> unit
|
||||
val add_initializer: table -> (obj -> unit) -> unit
|
||||
val create_table: string list -> table
|
||||
val init_class: table -> unit
|
||||
val new_variable : table -> string -> int
|
||||
val get_variable : table -> string -> int
|
||||
val get_method_label : table -> string -> label
|
||||
val get_method : table -> label -> meth
|
||||
val set_method : table -> label -> meth -> unit
|
||||
val narrow : table -> string list -> string list -> string list -> unit
|
||||
val widen : table -> unit
|
||||
val add_initializer : table -> (obj -> unit) -> unit
|
||||
val create_table : string list -> table
|
||||
val init_class : table -> unit
|
||||
|
||||
(** {2 Objects} *)
|
||||
|
||||
val create_object: table -> obj
|
||||
val run_initializers: obj -> table -> unit
|
||||
val send: obj -> label -> t
|
||||
val create_object : table -> obj
|
||||
val run_initializers : obj -> table -> unit
|
||||
val send : obj -> label -> t
|
||||
|
||||
(** {2 Parameters} *)
|
||||
|
||||
type params = {
|
||||
mutable compact_table : bool;
|
||||
type params =
|
||||
{ mutable compact_table : bool;
|
||||
mutable copy_parent : bool;
|
||||
mutable clean_when_copying : bool;
|
||||
mutable retry_count : int;
|
||||
mutable bucket_small_size : int
|
||||
}
|
||||
mutable bucket_small_size : int }
|
||||
|
||||
val params : params
|
||||
|
||||
(** {2 Statistics} *)
|
||||
|
||||
type stats =
|
||||
{ classes: int; labels: int; methods: int; inst_vars: int; buckets: int;
|
||||
distrib : int array; small_bucket_count: int; small_bucket_max: int }
|
||||
val stats: unit -> stats
|
||||
val show_buckets: unit -> unit
|
||||
{ classes : int;
|
||||
labels : int;
|
||||
methods : int;
|
||||
inst_vars : int;
|
||||
buckets : int;
|
||||
distrib : int array;
|
||||
small_bucket_count : int;
|
||||
small_bucket_max : int }
|
||||
val stats : unit -> stats
|
||||
val show_buckets : unit -> unit
|
||||
|
|
|
@ -14,37 +14,37 @@
|
|||
|
||||
(** The run-time library for parsers generated by [ocamlyacc]. *)
|
||||
|
||||
val symbol_start : unit -> int
|
||||
(** [symbol_start] and {!Parsing.symbol_end} are to be called in the action part
|
||||
of a grammar rule only. They return the position of the string that
|
||||
matches the left-hand side of the rule: [symbol_start()] returns
|
||||
the position of the first character; [symbol_end()] returns the
|
||||
position of the last character, plus one. The first character
|
||||
in a file is at position 0. *)
|
||||
val symbol_start : unit -> int
|
||||
|
||||
(** See {!Parsing.symbol_start}. *)
|
||||
val symbol_end : unit -> int
|
||||
(** See {!Parsing.symbol_start}. *)
|
||||
|
||||
val rhs_start : int -> int
|
||||
(** Same as {!Parsing.symbol_start} and {!Parsing.symbol_end}, but return the
|
||||
position of the string matching the [n]th item on the
|
||||
right-hand side of the rule, where [n] is the integer parameter
|
||||
to [lhs_start] and [lhs_end]. [n] is 1 for the leftmost item. *)
|
||||
val rhs_start: int -> int
|
||||
|
||||
val rhs_end : int -> int
|
||||
(** See {!Parsing.rhs_start}. *)
|
||||
val rhs_end: int -> int
|
||||
|
||||
val clear_parser : unit -> unit
|
||||
(** Empty the parser stack. Call it just after a parsing function
|
||||
has returned, to remove all pointers from the parser stack
|
||||
to structures that were built by semantic actions during parsing.
|
||||
This is optional, but lowers the memory requirements of the
|
||||
programs. *)
|
||||
val clear_parser : unit -> unit
|
||||
|
||||
exception Parse_error
|
||||
(** Raised when a parser encounters a syntax error.
|
||||
Can also be raised from the action part of a grammar rule,
|
||||
to initiate error recovery. *)
|
||||
exception Parse_error
|
||||
|
||||
|
||||
(**/**)
|
||||
|
@ -77,7 +77,7 @@ type parse_tables =
|
|||
exception YYexit of Obj.t
|
||||
|
||||
val yyparse :
|
||||
parse_tables -> int -> (Lexing.lexbuf -> 'a) -> Lexing.lexbuf -> 'b
|
||||
parse_tables -> int -> (Lexing.lexbuf -> 'a) -> Lexing.lexbuf -> 'b
|
||||
val peek_val : parser_env -> int -> 'a
|
||||
val is_current_lookahead : 'a -> bool
|
||||
val parse_error : string -> unit
|
||||
|
|
|
@ -46,8 +46,8 @@ These are predefined types :
|
|||
|
||||
(** {2 Exceptions} *)
|
||||
|
||||
(** Raise the given exception value *)
|
||||
external raise : exn -> 'a = "%raise"
|
||||
(** Raise the given exception value *)
|
||||
|
||||
(** These are predefined exceptions :
|
||||
{[exception Match_failure of (string * int * int)]}
|
||||
|
@ -101,39 +101,42 @@ external raise : exn -> 'a = "%raise"
|
|||
|
||||
*)
|
||||
|
||||
exception Exit
|
||||
(** The [Exit] exception is not raised by any library function. It is
|
||||
provided for use in your programs.*)
|
||||
exception Exit
|
||||
|
||||
val invalid_arg : string -> 'a
|
||||
(** Raise exception [Invalid_argument] with the given string. *)
|
||||
val invalid_arg: string -> 'a
|
||||
|
||||
val failwith : string -> 'a
|
||||
(** Raise exception [Failure] with the given string. *)
|
||||
val failwith: string -> 'a
|
||||
|
||||
|
||||
(** {2 Comparisons} *)
|
||||
|
||||
|
||||
external ( = ) : 'a -> 'a -> bool = "%equal"
|
||||
(** [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. *)
|
||||
external (=) : 'a -> 'a -> bool = "%equal"
|
||||
|
||||
external ( <> ) : 'a -> 'a -> bool = "%notequal"
|
||||
(** Negation of [Pervasives.=]. *)
|
||||
external (<>) : 'a -> 'a -> bool = "%notequal"
|
||||
|
||||
|
||||
external ( < ) : 'a -> 'a -> bool = "%lessthan"
|
||||
(** See {!Pervasives.>=}. *)
|
||||
external (<) : 'a -> 'a -> bool = "%lessthan"
|
||||
(** See {!Pervasives.>=}. *)
|
||||
external (>) : 'a -> 'a -> bool = "%greaterthan"
|
||||
(** See {!Pervasives.>=}. *)
|
||||
external (<=) : 'a -> 'a -> bool = "%lessequal"
|
||||
|
||||
external ( > ) : 'a -> 'a -> bool = "%greaterthan"
|
||||
(** See {!Pervasives.>=}. *)
|
||||
|
||||
external ( <= ) : 'a -> 'a -> bool = "%lessequal"
|
||||
(** See {!Pervasives.>=}. *)
|
||||
|
||||
external ( >= ) : 'a -> 'a -> bool = "%greaterequal"
|
||||
(** Structural ordering functions. These functions coincide with
|
||||
the usual orderings over integers, characters, strings
|
||||
and floating-point numbers, and extend them to a
|
||||
|
@ -142,20 +145,20 @@ external (<=) : 'a -> 'a -> bool = "%lessequal"
|
|||
of [(=)], mutable structures are compared by contents.
|
||||
Comparison between functional values raises [Invalid_argument].
|
||||
Comparison between cyclic structures may not terminate. *)
|
||||
external (>=) : 'a -> 'a -> bool = "%greaterequal"
|
||||
|
||||
external compare : 'a -> 'a -> int = "compare"
|
||||
(** [compare x y] returns [0] if [x=y], a negative integer if
|
||||
[x<y], and a positive integer if [x>y]. The same restrictions
|
||||
as for [=] apply. [compare] can be used as the comparison function
|
||||
required by the {!Set} and {!Map} modules. *)
|
||||
external compare: 'a -> 'a -> int = "compare"
|
||||
|
||||
val min : 'a -> 'a -> 'a
|
||||
(** Return the smaller of the two arguments. *)
|
||||
val min: 'a -> 'a -> 'a
|
||||
|
||||
val max : 'a -> 'a -> 'a
|
||||
(** Return the greater of the two arguments. *)
|
||||
val max: 'a -> 'a -> 'a
|
||||
|
||||
external ( == ) : 'a -> 'a -> bool = "%eq"
|
||||
(** [e1 == e2] tests for physical equality of [e1] and [e2].
|
||||
On integers and characters, it is the same as structural
|
||||
equality. On mutable structures, [e1 == e2] is true if and only if
|
||||
|
@ -163,34 +166,32 @@ val max: 'a -> 'a -> 'a
|
|||
On non-mutable structures, the behavior of [(==)] is
|
||||
implementation-dependent, except that [e1 == e2] implies
|
||||
[e1 = e2]. *)
|
||||
external (==) : 'a -> 'a -> bool = "%eq"
|
||||
|
||||
external ( != ) : 'a -> 'a -> bool = "%noteq"
|
||||
(** Negation of {!Pervasives.==}. *)
|
||||
external (!=) : 'a -> 'a -> bool = "%noteq"
|
||||
|
||||
|
||||
(** {2 Boolean operations} *)
|
||||
|
||||
|
||||
(** The boolean negation. *)
|
||||
external not : bool -> bool = "%boolnot"
|
||||
(** The boolean negation. *)
|
||||
|
||||
(** See {!Pervasives.&}. *)
|
||||
external (&&) : bool -> bool -> bool = "%sequand"
|
||||
|
||||
external ( && ) : bool -> bool -> bool = "%sequand"
|
||||
(** 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. *)
|
||||
external (&) : bool -> bool -> bool = "%sequand"
|
||||
|
||||
external ( & ) : bool -> bool -> bool = "%sequand"
|
||||
(** @deprecated {!Pervasives.&&} should be used instead. *)
|
||||
|
||||
external ( || ) : bool -> bool -> bool = "%sequor"
|
||||
(** See {!Pervasives.or}.*)
|
||||
external (||) : bool -> bool -> bool = "%sequor"
|
||||
|
||||
external ( or ) : bool -> bool -> bool = "%sequor"
|
||||
(** 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. *)
|
||||
external (or) : bool -> bool -> bool = "%sequor"
|
||||
|
||||
|
||||
(** {2 Integer arithmetic} *)
|
||||
|
@ -199,81 +200,82 @@ external (or) : bool -> bool -> bool = "%sequor"
|
|||
All operations are taken modulo 2{^31} (or 2{^63}).
|
||||
They do not fail on overflow. *)
|
||||
|
||||
external ( ~- ) : int -> int = "%negint"
|
||||
(** Unary negation. You can also write [-e] instead of [~-e]. *)
|
||||
external (~-) : int -> int = "%negint"
|
||||
|
||||
(** [succ x] is [x+1]. *)
|
||||
external succ : int -> int = "%succint"
|
||||
(** [succ x] is [x+1]. *)
|
||||
|
||||
(** [pred x] is [x-1]. *)
|
||||
external pred : int -> int = "%predint"
|
||||
(** [pred x] is [x-1]. *)
|
||||
|
||||
external ( + ) : int -> int -> int = "%addint"
|
||||
(** Integer addition. *)
|
||||
external (+) : int -> int -> int = "%addint"
|
||||
|
||||
external ( - ) : int -> int -> int = "%subint"
|
||||
(** Integer subtraction. *)
|
||||
external (-) : int -> int -> int = "%subint"
|
||||
|
||||
(** Integer multiplication. *)
|
||||
external ( * ) : int -> int -> int = "%mulint"
|
||||
(** Integer multiplication. *)
|
||||
|
||||
external ( / ) : int -> int -> int = "%divint"
|
||||
(** Integer division.
|
||||
Raise [Division_by_zero] if the second argument is 0.
|
||||
Integer division rounds the real quotient of its arguments towards zero.
|
||||
More precisely, if [x >= 0] and [y > 0], [x / y] is the greatest integer
|
||||
less than or equal to the real quotient of [x] by [y]. Moreover,
|
||||
[(-x) / y = x / (-y) = -(x / y)]. *)
|
||||
external (/) : int -> int -> int = "%divint"
|
||||
|
||||
external ( mod ) : int -> int -> int = "%modint"
|
||||
(** Integer remainder. If [y] is not zero, the result
|
||||
of [x mod y] satisfies the following properties:
|
||||
[x = (x / y) * y + x mod y] and
|
||||
[abs(x mod y) < abs(y)].
|
||||
If [y = 0], [x mod y] raises [Division_by_zero].
|
||||
Notice that [x mod y] is negative if [x < 0]. *)
|
||||
external (mod) : int -> int -> int = "%modint"
|
||||
|
||||
(** Return the absolute value of the argument. *)
|
||||
val abs : int -> int
|
||||
(** Return the absolute value of the argument. *)
|
||||
|
||||
val max_int : int
|
||||
(** The greatest representable integer. *)
|
||||
val max_int: int
|
||||
|
||||
val min_int : int
|
||||
(** The smallest representable integer. *)
|
||||
val min_int: int
|
||||
|
||||
|
||||
|
||||
(** {3 Bitwise operations} *)
|
||||
|
||||
|
||||
external ( land ) : int -> int -> int = "%andint"
|
||||
(** Bitwise logical and. *)
|
||||
external (land) : int -> int -> int = "%andint"
|
||||
|
||||
external ( lor ) : int -> int -> int = "%orint"
|
||||
(** Bitwise logical or. *)
|
||||
external (lor) : int -> int -> int = "%orint"
|
||||
|
||||
external ( lxor ) : int -> int -> int = "%xorint"
|
||||
(** Bitwise logical exclusive or. *)
|
||||
external (lxor) : int -> int -> int = "%xorint"
|
||||
|
||||
val lnot : int -> int
|
||||
(** Bitwise logical negation. *)
|
||||
val lnot: int -> int
|
||||
|
||||
external ( lsl ) : int -> int -> int = "%lslint"
|
||||
(** [n lsl m] shifts [n] to the left by [m] bits.
|
||||
The result is unspecified if [m < 0] or [m >= bitsize],
|
||||
where [bitsize] is [32] on a 32-bit platform and
|
||||
[64] on a 64-bit platform. *)
|
||||
external (lsl) : int -> int -> int = "%lslint"
|
||||
|
||||
external ( lsr ) : int -> int -> int = "%lsrint"
|
||||
(** [n lsr m] shifts [n] to the right by [m] bits.
|
||||
This is a logical shift: zeroes are inserted regardless of
|
||||
the sign of [n].
|
||||
The result is unspecified if [m < 0] or [m >= bitsize]. *)
|
||||
external (lsr) : int -> int -> int = "%lsrint"
|
||||
|
||||
external ( asr ) : int -> int -> int = "%asrint"
|
||||
(** [n asr m] shifts [n] to the right by [m] bits.
|
||||
This is an arithmetic shift: the sign bit of [n] is replicated.
|
||||
The result is unspecified if [m < 0] or [m >= bitsize]. *)
|
||||
external (asr) : int -> int -> int = "%asrint"
|
||||
|
||||
|
||||
(** {2 Floating-point arithmetic}
|
||||
|
@ -290,125 +292,144 @@ external (asr) : int -> int -> int = "%asrint"
|
|||
argument returns [nan] as result.
|
||||
*)
|
||||
|
||||
external ( ~-. ) : float -> float = "%negfloat"
|
||||
(** Unary negation. You can also write [-.e] instead of [~-.e]. *)
|
||||
external (~-.) : float -> float = "%negfloat"
|
||||
|
||||
external ( +. ) : float -> float -> float = "%addfloat"
|
||||
(** Floating-point addition *)
|
||||
external (+.) : float -> float -> float = "%addfloat"
|
||||
|
||||
external ( -. ) : float -> float -> float = "%subfloat"
|
||||
(** Floating-point subtraction *)
|
||||
external (-.) : float -> float -> float = "%subfloat"
|
||||
|
||||
(** Floating-point multiplication *)
|
||||
external ( *. ) : float -> float -> float = "%mulfloat"
|
||||
(** Floating-point multiplication *)
|
||||
|
||||
external ( /. ) : float -> float -> float = "%divfloat"
|
||||
(** Floating-point division. *)
|
||||
external (/.) : float -> float -> float = "%divfloat"
|
||||
|
||||
(** Exponentiation *)
|
||||
external ( ** ) : float -> float -> float = "power_float" "pow" "float"
|
||||
(** Exponentiation *)
|
||||
|
||||
(** Square root *)
|
||||
external sqrt : float -> float = "sqrt_float" "sqrt" "float"
|
||||
(** Square root *)
|
||||
|
||||
(** Exponential. *)
|
||||
external exp : float -> float = "exp_float" "exp" "float"
|
||||
(** Natural logarithm. *)
|
||||
(** Exponential. *)
|
||||
|
||||
external log : float -> float = "log_float" "log" "float"
|
||||
(** Base 10 logarithm. *)
|
||||
(** Natural logarithm. *)
|
||||
|
||||
external log10 : float -> float = "log10_float" "log10" "float"
|
||||
(** Base 10 logarithm. *)
|
||||
|
||||
external cos : float -> float = "cos_float" "cos" "float"
|
||||
(** See {!Pervasives.atan2}. *)
|
||||
|
||||
external sin : float -> float = "sin_float" "sin" "float"
|
||||
(** See {!Pervasives.atan2}. *)
|
||||
|
||||
external tan : float -> float = "tan_float" "tan" "float"
|
||||
(** See {!Pervasives.atan2}. *)
|
||||
|
||||
external acos : float -> float = "acos_float" "acos" "float"
|
||||
(** See {!Pervasives.atan2}. *)
|
||||
|
||||
external asin : float -> float = "asin_float" "asin" "float"
|
||||
(** See {!Pervasives.atan2}. *)
|
||||
external atan : float -> float = "atan_float" "atan" "float"
|
||||
(** The usual trigonometric functions. *)
|
||||
external atan2 : float -> float -> float = "atan2_float" "atan2" "float"
|
||||
|
||||
(** See {!Pervasives.tanh}. *)
|
||||
external atan : float -> float = "atan_float" "atan" "float"
|
||||
(** See {!Pervasives.atan2}. *)
|
||||
|
||||
external atan2 : float -> float -> float = "atan2_float" "atan2" "float"
|
||||
(** The usual trigonometric functions. *)
|
||||
|
||||
external cosh : float -> float = "cosh_float" "cosh" "float"
|
||||
(** See {!Pervasives.tanh}. *)
|
||||
external sinh : float -> float = "sinh_float" "sinh" "float"
|
||||
(** The usual hyperbolic trigonometric functions. *)
|
||||
external tanh : float -> float = "tanh_float" "tanh" "float"
|
||||
|
||||
(** See {!Pervasives.floor}. *)
|
||||
external sinh : float -> float = "sinh_float" "sinh" "float"
|
||||
(** See {!Pervasives.tanh}. *)
|
||||
|
||||
external tanh : float -> float = "tanh_float" "tanh" "float"
|
||||
(** The usual hyperbolic trigonometric functions. *)
|
||||
|
||||
external ceil : float -> float = "ceil_float" "ceil" "float"
|
||||
(** See {!Pervasives.floor}. *)
|
||||
|
||||
external floor : float -> float = "floor_float" "floor" "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]. *)
|
||||
external floor : float -> float = "floor_float" "floor" "float"
|
||||
|
||||
(** Return the absolute value of the argument. *)
|
||||
external abs_float : float -> float = "%absfloat"
|
||||
(** Return the absolute value of the argument. *)
|
||||
|
||||
external mod_float : float -> float -> float = "fmod_float" "fmod" "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. *)
|
||||
external mod_float : float -> float -> float = "fmod_float" "fmod" "float"
|
||||
|
||||
external frexp : float -> float * int = "frexp_float"
|
||||
(** [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]. *)
|
||||
external frexp : float -> float * int = "frexp_float"
|
||||
|
||||
(** [ldexp x n] returns [x *. 2 ** n]. *)
|
||||
external ldexp : float -> int -> float = "ldexp_float"
|
||||
(** [ldexp x n] returns [x *. 2 ** n]. *)
|
||||
|
||||
external modf : float -> float * float = "modf_float"
|
||||
(** [modf f] returns the pair of the fractional and integral
|
||||
part of [f]. *)
|
||||
external modf : float -> float * float = "modf_float"
|
||||
|
||||
(** Same as {!Pervasives.float_of_int}. *)
|
||||
external float : int -> float = "%floatofint"
|
||||
(** Convert an integer to floating-point. *)
|
||||
external float_of_int : int -> float = "%floatofint"
|
||||
(** Same as {!Pervasives.float_of_int}. *)
|
||||
|
||||
external float_of_int : int -> float = "%floatofint"
|
||||
(** Convert an integer to floating-point. *)
|
||||
|
||||
(** Same as {!Pervasives.int_of_float}. *)
|
||||
external truncate : float -> int = "%intoffloat"
|
||||
(** Same as {!Pervasives.int_of_float}. *)
|
||||
|
||||
external int_of_float : float -> int = "%intoffloat"
|
||||
(** Truncate the given floating-point number to an integer.
|
||||
The result is unspecified if it falls outside the
|
||||
range of representable integers. *)
|
||||
external int_of_float : float -> int = "%intoffloat"
|
||||
|
||||
val infinity : float
|
||||
(** Positive infinity. *)
|
||||
val infinity: float
|
||||
|
||||
val neg_infinity : float
|
||||
(** Negative infinity. *)
|
||||
val neg_infinity: float
|
||||
|
||||
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''. *)
|
||||
val nan: float
|
||||
(** The largest positive finite value of type [float]. *)
|
||||
val max_float: float
|
||||
(** The smallest positive, non-zero, non-denormalized value of type [float]. *)
|
||||
val min_float: float
|
||||
(** The smallest positive float [x] such that [1.0 +. x <> 1.0]. *)
|
||||
val epsilon_float: float
|
||||
|
||||
(** The five classes of floating-point numbers, as determined by
|
||||
the {!Pervasives.classify_float} function. *)
|
||||
val max_float : float
|
||||
(** The largest positive finite value of type [float]. *)
|
||||
|
||||
val min_float : float
|
||||
(** The smallest positive, non-zero, non-denormalized value of type [float]. *)
|
||||
|
||||
val epsilon_float : float
|
||||
(** The smallest positive float [x] such that [1.0 +. x <> 1.0]. *)
|
||||
|
||||
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 {!Pervasives.classify_float} function. *)
|
||||
|
||||
external classify_float : float -> fpclass = "classify_float"
|
||||
(** Return the class of the given floating-point number:
|
||||
normal, subnormal, zero, infinite, or not a number. *)
|
||||
external classify_float: float -> fpclass = "classify_float"
|
||||
|
||||
|
||||
(** {2 String operations}
|
||||
|
@ -416,8 +437,8 @@ external classify_float: float -> fpclass = "classify_float"
|
|||
More string operations are provided in module {!String}.
|
||||
*)
|
||||
|
||||
val ( ^ ) : string -> string -> string
|
||||
(** String concatenation. *)
|
||||
val (^) : string -> string -> string
|
||||
|
||||
|
||||
(** {2 Character operations}
|
||||
|
@ -425,64 +446,63 @@ val (^) : string -> string -> string
|
|||
More character operations are provided in module {!Char}.
|
||||
*)
|
||||
|
||||
(** Return the ASCII code of the argument. *)
|
||||
external int_of_char : char -> int = "%identity"
|
||||
(** Return the ASCII code of the argument. *)
|
||||
|
||||
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. *)
|
||||
val char_of_int : int -> char
|
||||
|
||||
|
||||
(** {2 Unit operations} *)
|
||||
|
||||
|
||||
external ignore : 'a -> unit = "%ignore"
|
||||
(** 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. *)
|
||||
external ignore : 'a -> unit = "%ignore"
|
||||
|
||||
|
||||
(** {2 String conversion functions} *)
|
||||
|
||||
(** Return the string representation of a boolean. *)
|
||||
val string_of_bool : bool -> string
|
||||
(** Return the string representation of a boolean. *)
|
||||
|
||||
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 bool_of_string : string -> bool
|
||||
|
||||
(** Return the string representation of an integer, in decimal. *)
|
||||
val string_of_int : int -> string
|
||||
(** Return the string representation of an integer, in decimal. *)
|
||||
|
||||
external int_of_string : string -> int = "int_of_string"
|
||||
(** 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. *)
|
||||
external int_of_string : string -> int = "int_of_string"
|
||||
|
||||
(** Return the string representation of a floating-point number. *)
|
||||
val string_of_float : float -> string
|
||||
(** Return the string representation of a floating-point number. *)
|
||||
|
||||
external float_of_string : string -> float = "float_of_string"
|
||||
(** Convert the given string to a float. Raise [Failure "float_of_string"]
|
||||
if the given string is not a valid representation of a float. *)
|
||||
external float_of_string : string -> float = "float_of_string"
|
||||
|
||||
|
||||
|
||||
(** {2 Pair operations} *)
|
||||
|
||||
|
||||
(** Return the first component of a pair. *)
|
||||
external fst : 'a * 'b -> 'a = "%field0"
|
||||
(** Return the second component of a pair. *)
|
||||
(** Return the first component of a pair. *)
|
||||
|
||||
external snd : 'a * 'b -> 'b = "%field1"
|
||||
(** Return the second component of a pair. *)
|
||||
|
||||
|
||||
(** {2 List operations}
|
||||
|
@ -490,94 +510,96 @@ external snd : 'a * 'b -> 'b = "%field1"
|
|||
More list operations are provided in module {!List}.
|
||||
*)
|
||||
|
||||
val ( @ ) : 'a list -> 'a list -> 'a list
|
||||
(** List concatenation. *)
|
||||
val (@) : 'a list -> 'a list -> 'a list
|
||||
|
||||
|
||||
(** {2 Input/output} *)
|
||||
|
||||
(** The type of input channel. *)
|
||||
type in_channel
|
||||
(** The type of output channel. *)
|
||||
type out_channel
|
||||
(** The type of input channel. *)
|
||||
|
||||
type out_channel
|
||||
(** The type of output channel. *)
|
||||
|
||||
(** The standard input for the process. *)
|
||||
val stdin : in_channel
|
||||
(** The standard output for the process. *)
|
||||
(** The standard input for the process. *)
|
||||
|
||||
val stdout : out_channel
|
||||
(** The standard error ouput for the process. *)
|
||||
(** The standard output for the process. *)
|
||||
|
||||
val stderr : out_channel
|
||||
(** The standard error ouput for the process. *)
|
||||
|
||||
|
||||
(** {3 Output functions on standard output} *)
|
||||
|
||||
(** Print a character on standard output. *)
|
||||
val print_char : char -> unit
|
||||
(** Print a character on standard output. *)
|
||||
|
||||
(** Print a string on standard output. *)
|
||||
val print_string : string -> unit
|
||||
(** Print a string on standard output. *)
|
||||
|
||||
(** Print an integer, in decimal, on standard output. *)
|
||||
val print_int : int -> unit
|
||||
(** Print an integer, in decimal, on standard output. *)
|
||||
|
||||
(** Print a floating-point number, in decimal, on standard output. *)
|
||||
val print_float : float -> unit
|
||||
(** Print a floating-point number, in decimal, on standard output. *)
|
||||
|
||||
val print_endline : string -> unit
|
||||
(** Print a string, followed by a newline character, on
|
||||
standard output. *)
|
||||
val print_endline : string -> unit
|
||||
|
||||
val print_newline : unit -> unit
|
||||
(** Print a newline character on standard output, and flush
|
||||
standard output. This can be used to simulate line
|
||||
buffering of standard output. *)
|
||||
val print_newline : unit -> unit
|
||||
|
||||
|
||||
(** {3 Output functions on standard error} *)
|
||||
|
||||
(** Print a character on standard error. *)
|
||||
val prerr_char : char -> unit
|
||||
(** Print a character on standard error. *)
|
||||
|
||||
(** Print a string on standard error. *)
|
||||
val prerr_string : string -> unit
|
||||
(** Print a string on standard error. *)
|
||||
|
||||
(** Print an integer, in decimal, on standard error. *)
|
||||
val prerr_int : int -> unit
|
||||
(** Print an integer, in decimal, on standard error. *)
|
||||
|
||||
(** Print a floating-point number, 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_endline : string -> unit
|
||||
|
||||
val prerr_newline : unit -> unit
|
||||
(** Print a newline character on standard error, and flush
|
||||
standard error. *)
|
||||
val prerr_newline : unit -> unit
|
||||
|
||||
|
||||
(** {3 Input functions on standard input} *)
|
||||
|
||||
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_line : unit -> string
|
||||
|
||||
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_int : unit -> int
|
||||
|
||||
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. *)
|
||||
val read_float : unit -> float
|
||||
|
||||
(** {3 General output functions} *)
|
||||
|
||||
|
||||
(** Opening modes for {!Pervasives.open_out_gen} and {!Pervasives.open_in_gen}. *)
|
||||
type open_flag =
|
||||
Open_rdonly (** open for reading. *)
|
||||
| Open_wronly (** open for writing. *)
|
||||
|
@ -588,86 +610,88 @@ type open_flag =
|
|||
| Open_binary (** open in binary mode (no conversion). *)
|
||||
| Open_text (** open in text mode (may perform conversions). *)
|
||||
| Open_nonblock (** open in non-blocking mode. *)
|
||||
(** Opening modes for {!Pervasives.open_out_gen} and {!Pervasives.open_in_gen}. *)
|
||||
|
||||
val open_out : string -> out_channel
|
||||
(** Open the named file for writing, and return a new output channel
|
||||
on that file, positionned 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.
|
||||
Raise [Sys_error] if the file could not be opened. *)
|
||||
val open_out : string -> out_channel
|
||||
|
||||
val open_out_bin : string -> out_channel
|
||||
(** Same as {!Pervasives.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 {!Pervasives.open_out}. *)
|
||||
val open_out_bin : string -> out_channel
|
||||
|
||||
val open_out_gen : open_flag list -> 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.
|
||||
{!Pervasives.open_out} and {!Pervasives.open_out_bin} are special
|
||||
cases of this function. *)
|
||||
val open_out_gen : open_flag list -> int -> string -> out_channel
|
||||
|
||||
val flush : out_channel -> unit
|
||||
(** 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. *)
|
||||
val flush : out_channel -> unit
|
||||
|
||||
(** Flush all opened output channels. *)
|
||||
val flush_all : unit -> unit
|
||||
(** Flush all opened output channels. *)
|
||||
|
||||
(** Write the character on the given output channel. *)
|
||||
val output_char : out_channel -> char -> unit
|
||||
(** Write the character on the given output channel. *)
|
||||
|
||||
(** Write the string on the given output channel. *)
|
||||
val output_string : out_channel -> string -> unit
|
||||
(** Write the string on the given output channel. *)
|
||||
|
||||
val output : out_channel -> string -> int -> 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 : out_channel -> string -> int -> int -> unit
|
||||
|
||||
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_byte : out_channel -> int -> unit
|
||||
|
||||
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
|
||||
{!Pervasives.input_binary_int} function. The format is compatible across
|
||||
all machines for a given version of Objective Caml. *)
|
||||
val output_binary_int : out_channel -> int -> unit
|
||||
|
||||
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 {!Pervasives.input_value}. See the description of module
|
||||
{!Marshal} for more information. {!Pervasives.output_value} is equivalent
|
||||
to {!Marshal.to_channel} with an empty list of flags. *)
|
||||
val output_value : out_channel -> 'a -> unit
|
||||
|
||||
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 seek_out : out_channel -> int -> unit
|
||||
|
||||
(** Return the current writing position for the given channel. *)
|
||||
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 out_channel_length : out_channel -> int
|
||||
|
||||
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 close_out : out_channel -> unit
|
||||
|
||||
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
|
||||
|
@ -676,39 +700,39 @@ val close_out : out_channel -> unit
|
|||
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. *)
|
||||
val set_binary_mode_out : out_channel -> bool -> unit
|
||||
|
||||
|
||||
(** {3 General input functions} *)
|
||||
|
||||
val open_in : string -> in_channel
|
||||
(** Open the named file for reading, and return a new input channel
|
||||
on that file, positionned at the beginning of the file.
|
||||
Raise [Sys_error] if the file could not be opened. *)
|
||||
val open_in : string -> in_channel
|
||||
|
||||
val open_in_bin : string -> in_channel
|
||||
(** Same as {!Pervasives.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 {!Pervasives.open_in}. *)
|
||||
val open_in_bin : string -> in_channel
|
||||
|
||||
val open_in_gen : open_flag list -> 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.
|
||||
{!Pervasives.open_in} and {!Pervasives.open_in_bin} are special
|
||||
cases of this function. *)
|
||||
val open_in_gen : open_flag list -> int -> string -> in_channel
|
||||
|
||||
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_char : in_channel -> char
|
||||
|
||||
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_line : in_channel -> string
|
||||
|
||||
val input : in_channel -> string -> int -> 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
|
||||
|
@ -723,51 +747,51 @@ val input_line : in_channel -> string
|
|||
exactly [len] characters.)
|
||||
Exception [Invalid_argument "input"] is raised if [pos] and [len]
|
||||
do not designate a valid substring of [buf]. *)
|
||||
val input : in_channel -> string -> int -> int -> int
|
||||
|
||||
val really_input : in_channel -> string -> int -> 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 really_input : in_channel -> string -> int -> int -> unit
|
||||
|
||||
val input_byte : in_channel -> int
|
||||
(** Same as {!Pervasives.input_char}, but return the 8-bit integer representing
|
||||
the character.
|
||||
Raise [End_of_file] if an end of file was reached. *)
|
||||
val input_byte : in_channel -> int
|
||||
|
||||
val input_binary_int : in_channel -> int
|
||||
(** Read an integer encoded in binary format from the given input
|
||||
channel. See {!Pervasives.output_binary_int}.
|
||||
Raise [End_of_file] if an end of file was reached while reading the
|
||||
integer. *)
|
||||
val input_binary_int : in_channel -> int
|
||||
|
||||
val input_value : in_channel -> 'a
|
||||
(** Read the representation of a structured value, as produced
|
||||
by {!Pervasives.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 input_value : in_channel -> 'a
|
||||
|
||||
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 seek_in : in_channel -> int -> unit
|
||||
|
||||
(** Return the current reading position for the given channel. *)
|
||||
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 in_channel_length : in_channel -> int
|
||||
|
||||
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 close_in : in_channel -> unit
|
||||
|
||||
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
|
||||
|
@ -776,39 +800,39 @@ val close_in : in_channel -> unit
|
|||
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. *)
|
||||
val set_binary_mode_in : in_channel -> bool -> unit
|
||||
|
||||
|
||||
(** {2 References} *)
|
||||
|
||||
|
||||
type 'a ref = { mutable contents : 'a }
|
||||
(** The type of references (mutable indirection cells) containing
|
||||
a value of type ['a]. *)
|
||||
type 'a ref = { mutable contents: 'a }
|
||||
|
||||
(** Return a fresh reference containing the given value. *)
|
||||
external ref : 'a -> 'a ref = "%makemutable"
|
||||
(** Return a fresh reference containing the given value. *)
|
||||
|
||||
external ( ! ) : 'a ref -> 'a = "%field0"
|
||||
(** [!r] returns the current contents of reference [r].
|
||||
Equivalent to [fun r -> r.contents]. *)
|
||||
external (!) : 'a ref -> 'a = "%field0"
|
||||
|
||||
external ( := ) : 'a ref -> 'a -> unit = "%setfield0"
|
||||
(** [r := a] stores the value of [a] in reference [r].
|
||||
Equivalent to [fun r v -> r.contents <- v]. *)
|
||||
external (:=) : 'a ref -> 'a -> unit = "%setfield0"
|
||||
|
||||
external incr : int ref -> unit = "%incr"
|
||||
(** Increment the integer contained in the given reference.
|
||||
Equivalent to [fun r -> r := succ !r]. *)
|
||||
external incr : int ref -> unit = "%incr"
|
||||
|
||||
external decr : int ref -> unit = "%decr"
|
||||
(** Decrement the integer contained in the given reference.
|
||||
Equivalent to [fun r -> r := pred !r]. *)
|
||||
external decr : int ref -> unit = "%decr"
|
||||
|
||||
|
||||
(** {2 Program termination} *)
|
||||
|
||||
|
||||
val exit : int -> 'a
|
||||
(** Flush all pending writes on {!Pervasives.stdout} and
|
||||
{!Pervasives.stderr},
|
||||
and terminate the process, returning the given status code
|
||||
|
@ -817,8 +841,8 @@ external decr : int ref -> unit = "%decr"
|
|||
An implicit [exit 0] is performed each time a program
|
||||
terminates normally (but not if it terminates because of
|
||||
an uncaught exception). *)
|
||||
val exit : int -> 'a
|
||||
|
||||
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 {!Pervasives.exit}.
|
||||
|
@ -826,7 +850,6 @@ val exit : int -> 'a
|
|||
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. *)
|
||||
val at_exit: (unit -> unit) -> unit
|
||||
|
||||
|
||||
(**/**)
|
||||
|
@ -835,4 +858,4 @@ val at_exit: (unit -> unit) -> unit
|
|||
|
||||
val unsafe_really_input : in_channel -> string -> int -> int -> unit
|
||||
|
||||
val do_at_exit: unit -> unit
|
||||
val do_at_exit : unit -> unit
|
||||
|
|
|
@ -14,18 +14,19 @@
|
|||
|
||||
(** Facilities for printing exceptions. *)
|
||||
|
||||
val to_string : exn -> string
|
||||
(** [Printexc.to_string e] returns a string representation of
|
||||
the exception [e]. *)
|
||||
val to_string : exn -> string
|
||||
|
||||
val print : ('a -> 'b) -> 'a -> 'b
|
||||
(** [Printexc.print fn x] applies [fn] to [x] and returns the result.
|
||||
If the evaluation of [fn x] raises any exception, the
|
||||
name of the exception is printed on standard error output,
|
||||
and the exception is raised again.
|
||||
The typical use is to catch and report exceptions that
|
||||
escape a function application. *)
|
||||
val print: ('a -> 'b) -> 'a -> 'b
|
||||
|
||||
val catch : ('a -> 'b) -> 'a -> 'b
|
||||
(** [Printexc.catch fn x] is similar to {!Printexc.print}, but
|
||||
aborts the program with exit code 2 after printing the
|
||||
uncaught exception. This function is deprecated: the runtime
|
||||
|
@ -34,5 +35,4 @@ val print: ('a -> 'b) -> 'a -> 'b
|
|||
makes it harder to track the location of the exception
|
||||
using the debugger or the stack backtrace facility.
|
||||
So, do not use [Printexc.catch] in new code. *)
|
||||
val catch: ('a -> 'b) -> 'a -> 'b
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
(** Formatted output functions. *)
|
||||
|
||||
val fprintf : out_channel -> ('a, out_channel, unit) format -> 'a
|
||||
(** [fprintf outchan format arg1 ... argN] formats the arguments
|
||||
[arg1] to [argN] according to the format string [format],
|
||||
and outputs the resulting string on the channel [outchan].
|
||||
|
@ -83,29 +84,27 @@
|
|||
prints [x=1 y=2 3] instead of the expected
|
||||
[x=1 y=2 x=1 y=3]. To get the expected behavior, do
|
||||
[List.iter (fun y -> printf "x=%d y=%d " 1 y) [2;3]]. *)
|
||||
val fprintf: out_channel -> ('a, out_channel, unit) format -> 'a
|
||||
|
||||
val printf : ('a, out_channel, unit) format -> 'a
|
||||
(** Same as {!Printf.fprintf}, but output on [stdout]. *)
|
||||
val printf: ('a, out_channel, unit) format -> 'a
|
||||
|
||||
val eprintf : ('a, out_channel, unit) format -> 'a
|
||||
(** Same as {!Printf.fprintf}, but output on [stderr]. *)
|
||||
val eprintf: ('a, out_channel, unit) format -> 'a
|
||||
|
||||
val sprintf : ('a, unit, string) format -> 'a
|
||||
(** Same as {!Printf.fprintf}, but instead of printing on an output channel,
|
||||
return a string containing the result of formatting
|
||||
the arguments. *)
|
||||
val sprintf: ('a, unit, string) format -> 'a
|
||||
|
||||
val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a
|
||||
(** Same as {!Printf.fprintf}, but instead of printing on an output channel,
|
||||
append the formatted arguments to the given extensible buffer
|
||||
(see module {!Buffer}). *)
|
||||
val bprintf: Buffer.t -> ('a, Buffer.t, unit) format -> 'a
|
||||
|
||||
(**/**)
|
||||
|
||||
(* For system use only. Don't call directly. *)
|
||||
|
||||
val scan_format:
|
||||
string -> int -> (string -> int -> 'a)
|
||||
-> ('b ->'c -> int -> 'a)
|
||||
-> ('e -> int -> 'a) -> 'a
|
||||
val scan_format :
|
||||
string -> int -> (string -> int -> 'a) -> ('b -> 'c -> int -> 'a) ->
|
||||
('e -> int -> 'a) -> 'a
|
||||
|
|
|
@ -17,36 +17,36 @@
|
|||
This module implements queues (FIFOs), with in-place modification.
|
||||
*)
|
||||
|
||||
(** The type of queues containing elements of type ['a]. *)
|
||||
type 'a t
|
||||
(** The type of queues containing elements of type ['a]. *)
|
||||
|
||||
|
||||
(** Raised when {!Queue.take} or {!Queue.peek} is applied to an empty queue. *)
|
||||
exception Empty
|
||||
(** Raised when {!Queue.take} or {!Queue.peek} is applied to an empty queue. *)
|
||||
|
||||
|
||||
val create : unit -> 'a t
|
||||
(** Return a new queue, initially empty. *)
|
||||
val create: unit -> 'a t
|
||||
|
||||
val add : 'a -> 'a t -> unit
|
||||
(** [add x q] adds the element [x] at the end of the queue [q]. *)
|
||||
val add: 'a -> 'a t -> unit
|
||||
|
||||
val take : 'a t -> 'a
|
||||
(** [take q] removes and returns the first element in queue [q],
|
||||
or raises [Empty] if the queue is empty. *)
|
||||
val take: 'a t -> 'a
|
||||
|
||||
val peek : 'a t -> 'a
|
||||
(** [peek q] returns the first element in queue [q], without removing
|
||||
it from the queue, or raises [Empty] if the queue is empty. *)
|
||||
val peek: 'a t -> 'a
|
||||
|
||||
val clear : 'a t -> unit
|
||||
(** Discard all elements from a queue. *)
|
||||
val clear: 'a t -> unit
|
||||
|
||||
val length : 'a t -> int
|
||||
(** Return the number of elements in a queue. *)
|
||||
val length: 'a t -> int
|
||||
|
||||
val iter : ('a -> unit) -> 'a t -> unit
|
||||
(** [iter f q] applies [f] in turn to all elements of [q],
|
||||
from the least recently entered to the most recently entered.
|
||||
The queue itself is unchanged. *)
|
||||
val iter: ('a -> unit) -> 'a t -> unit
|
||||
|
||||
|
|
|
@ -14,40 +14,40 @@
|
|||
|
||||
(** Pseudo-random number generator (PRNG). *)
|
||||
|
||||
val init : int -> unit
|
||||
(** Initialize the generator, using the argument as a seed.
|
||||
The same seed will always yield the same sequence of numbers. *)
|
||||
val init : int -> unit
|
||||
|
||||
(** Same as {!Random.init} but takes more data as seed. *)
|
||||
val full_init : int array -> unit
|
||||
(** Same as {!Random.init} but takes more data as seed. *)
|
||||
|
||||
val self_init : unit -> unit
|
||||
(** Initialize the generator with a more-or-less random seed chosen
|
||||
in a system-dependent way. *)
|
||||
val self_init : unit -> unit
|
||||
|
||||
(** Return 30 random bits in a nonnegative integer. *)
|
||||
val bits : unit -> int
|
||||
(** Return 30 random bits in a nonnegative integer. *)
|
||||
|
||||
val int : int -> int
|
||||
(** [Random.int bound] returns a random integer between 0 (inclusive)
|
||||
and [bound] (exclusive). [bound] must be more than 0 and less
|
||||
than 2{^30}. *)
|
||||
val int : int -> int
|
||||
|
||||
val float : float -> float
|
||||
(** [Random.float bound] returns a random floating-point number
|
||||
between 0 (inclusive) and [bound] (exclusive). If [bound] is
|
||||
negative, the result is negative. If [bound] is 0, the result
|
||||
is 0. *)
|
||||
val float : float -> float
|
||||
|
||||
type state
|
||||
(** Values of this type are used to store the current state of the
|
||||
generator. *)
|
||||
type state;;
|
||||
|
||||
val get_state : unit -> state
|
||||
(** Returns the current state of the generator. This is useful for
|
||||
checkpointing computations that use the PRNG. *)
|
||||
val get_state : unit -> state;;
|
||||
|
||||
val set_state : state -> unit
|
||||
(** Resets the state of the generator to some previous state returned by
|
||||
{!Random.get_state}. *)
|
||||
val set_state : state -> unit;;
|
||||
|
||||
|
|
128
stdlib/set.mli
128
stdlib/set.mli
|
@ -22,6 +22,7 @@
|
|||
logarithmic in the size of the set, for instance.
|
||||
*)
|
||||
|
||||
module type OrderedType = sig type t val compare : t -> t -> int end
|
||||
(** The input signature of the functor {!Set.Make}.
|
||||
[t] is the type of the set elements.
|
||||
[compare] is a total ordering function over the set elements.
|
||||
|
@ -31,114 +32,37 @@
|
|||
and [f e1 e2] is strictly positive if [e1] is greater than [e2].
|
||||
Example: a suitable ordering function is
|
||||
the generic structural comparison function {!Pervasives.compare}. *)
|
||||
module type OrderedType =
|
||||
sig
|
||||
type t
|
||||
val compare: t -> t -> int
|
||||
end
|
||||
|
||||
|
||||
module type S =
|
||||
sig
|
||||
(** The type of the set elements. *)
|
||||
type elt
|
||||
|
||||
(** The type of sets. *)
|
||||
type t
|
||||
|
||||
(** The empty set. *)
|
||||
val empty: t
|
||||
|
||||
(** Test whether a set is empty or not. *)
|
||||
val is_empty: t -> bool
|
||||
|
||||
(** [mem x s] tests whether [x] belongs to the set [s]. *)
|
||||
val mem: elt -> t -> bool
|
||||
|
||||
(** [add x s] returns a set containing all elements of [s],
|
||||
plus [x]. If [x] was already in [s], [s] is returned unchanged. *)
|
||||
val add: elt -> t -> t
|
||||
|
||||
(** [singleton x] returns the one-element set containing only [x]. *)
|
||||
val singleton: elt -> t
|
||||
|
||||
(** [remove x s] returns a set containing all elements of [s],
|
||||
except [x]. If [x] was not in [s], [s] is returned unchanged. *)
|
||||
val remove: elt -> t -> t
|
||||
|
||||
(** Set union. *)
|
||||
val union: t -> t -> t
|
||||
(** Set interseection. *)
|
||||
val inter: t -> t -> t
|
||||
(** Set difference. *)
|
||||
val diff: t -> t -> t
|
||||
|
||||
(** Total ordering between sets. Can be used as the ordering function
|
||||
for doing sets of sets. *)
|
||||
val compare: t -> t -> int
|
||||
|
||||
(** [equal s1 s2] tests whether the sets [s1] and [s2] are
|
||||
equal, that is, contain equal elements. *)
|
||||
val equal: t -> t -> bool
|
||||
|
||||
(** [subset s1 s2] tests whether the set [s1] is a subset of
|
||||
the set [s2]. *)
|
||||
val subset: t -> t -> bool
|
||||
|
||||
(** [iter f s] applies [f] in turn to all elements of [s].
|
||||
The order in which the elements of [s] are presented to [f]
|
||||
is unspecified. *)
|
||||
val iter: (elt -> unit) -> t -> unit
|
||||
|
||||
(** [fold f s a] computes [(f xN ... (f x2 (f x1 a))...)],
|
||||
where [x1 ... xN] are the elements of [s].
|
||||
The order in which elements of [s] are presented to [f] is
|
||||
unspecified. *)
|
||||
val fold: (elt -> 'a -> 'a) -> t -> 'a -> 'a
|
||||
|
||||
(** [for_all p s] checks if all elements of the set
|
||||
satisfy the predicate [p]. *)
|
||||
val for_all: (elt -> bool) -> t -> bool
|
||||
|
||||
(** [exists p s] checks if at least one element of
|
||||
the set satisfies the predicate [p]. *)
|
||||
val exists: (elt -> bool) -> t -> bool
|
||||
|
||||
(** [filter p s] returns the set of all elements in [s]
|
||||
that satisfy predicate [p]. *)
|
||||
val filter: (elt -> bool) -> t -> t
|
||||
|
||||
(** [partition p s] returns a pair of sets [(s1, s2)], where
|
||||
[s1] is the set of all the elements of [s] that satisfy the
|
||||
predicate [p], and [s2] is the set of all the elements of
|
||||
[s] that do not satisfy [p]. *)
|
||||
val partition: (elt -> bool) -> t -> t * t
|
||||
|
||||
(** Return the number of elements of a set. *)
|
||||
val cardinal: t -> int
|
||||
|
||||
(** Return the list of all elements of the given set.
|
||||
The returned list is sorted in increasing order with respect
|
||||
to the ordering [Ord.compare], where [Ord] is the argument
|
||||
given to {!Set.Make}. *)
|
||||
val elements: t -> elt list
|
||||
|
||||
(** Return the smallest element of the given set
|
||||
(with respect to the [Ord.compare] ordering), or raise
|
||||
[Not_found] if the set is empty. *)
|
||||
val min_elt: t -> elt
|
||||
|
||||
(** Same as {!Set.S.min_elt}, but returns the largest element of the
|
||||
given set. *)
|
||||
val max_elt: t -> elt
|
||||
|
||||
(** Return one element of the given set, or raise [Not_found] if
|
||||
the set is empty. Which element is chosen is unspecified,
|
||||
but equal elements will be chosen for equal sets. *)
|
||||
val choose: t -> elt
|
||||
|
||||
val empty : t
|
||||
val is_empty : t -> bool
|
||||
val mem : elt -> t -> bool
|
||||
val add : elt -> t -> t
|
||||
val singleton : elt -> t
|
||||
val remove : elt -> t -> t
|
||||
val union : t -> t -> t
|
||||
val inter : t -> t -> t
|
||||
val diff : t -> t -> t
|
||||
val compare : t -> t -> int
|
||||
val equal : t -> t -> bool
|
||||
val subset : t -> t -> bool
|
||||
val iter : (elt -> unit) -> t -> unit
|
||||
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
|
||||
val for_all : (elt -> bool) -> t -> bool
|
||||
val exists : (elt -> bool) -> t -> bool
|
||||
val filter : (elt -> bool) -> t -> t
|
||||
val partition : (elt -> bool) -> t -> t * t
|
||||
val cardinal : t -> int
|
||||
val elements : t -> elt list
|
||||
val min_elt : t -> elt
|
||||
val max_elt : t -> elt
|
||||
val choose : t -> elt
|
||||
end
|
||||
|
||||
module Make (Ord : OrderedType) : S with type elt = Ord.t
|
||||
(** Functor building an implementation of the set structure
|
||||
given a totally ordered type. *)
|
||||
module Make (Ord : OrderedType): (S with type elt = Ord.t)
|
||||
given a totally ordered type. *)
|
||||
|
|
|
@ -20,22 +20,22 @@
|
|||
The new functions are faster and use less memory.
|
||||
*)
|
||||
|
||||
val list : ('a -> 'a -> bool) -> 'a list -> 'a list
|
||||
(** Sort a list in increasing order according to an ordering predicate.
|
||||
The predicate should return [true] if its first argument is
|
||||
less than or equal to its second argument. *)
|
||||
val list : ('a -> 'a -> bool) -> 'a list -> 'a list
|
||||
|
||||
val array : ('a -> 'a -> bool) -> 'a array -> unit
|
||||
(** Sort an array in increasing order according to an
|
||||
ordering predicate.
|
||||
The predicate should return [true] if its first argument is
|
||||
less than or equal to its second argument.
|
||||
The array is sorted in place. *)
|
||||
val array : ('a -> 'a -> bool) -> 'a array -> unit
|
||||
|
||||
val merge : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
|
||||
(** Merge two lists according to the given predicate.
|
||||
Assuming the two argument lists are sorted according to the
|
||||
predicate, [merge] returns a sorted list containing the elements
|
||||
from the two lists. The behavior is undefined if the two
|
||||
argument lists were not sorted. *)
|
||||
val merge : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
|
||||
|
||||
|
|
|
@ -17,38 +17,38 @@
|
|||
This module implements stacks (LIFOs), with in-place modification.
|
||||
*)
|
||||
|
||||
(** The type of stacks containing elements of type ['a]. *)
|
||||
type 'a t
|
||||
(** The type of stacks containing elements of type ['a]. *)
|
||||
|
||||
(** Raised when {!Stack.pop} or {!Stack.top} is applied to an empty stack. *)
|
||||
exception Empty
|
||||
(** Raised when {!Stack.pop} or {!Stack.top} is applied to an empty stack. *)
|
||||
|
||||
|
||||
val create : unit -> 'a t
|
||||
(** Return a new stack, initially empty. *)
|
||||
val create: unit -> 'a t
|
||||
|
||||
val push : 'a -> 'a t -> unit
|
||||
(** [push x s] adds the element [x] at the top of stack [s]. *)
|
||||
val push: 'a -> 'a t -> unit
|
||||
|
||||
val pop : 'a t -> 'a
|
||||
(** [pop s] removes and returns the topmost element in stack [s],
|
||||
or raises [Empty] if the stack is empty. *)
|
||||
val pop: 'a t -> 'a
|
||||
|
||||
val top : 'a t -> 'a
|
||||
(** [top s] returns the topmost element in stack [s],
|
||||
or raises [Empty] if the stack is empty. *)
|
||||
val top: 'a t -> 'a
|
||||
|
||||
val clear : 'a t -> unit
|
||||
(** Discard all elements from a stack. *)
|
||||
val clear: 'a t -> unit
|
||||
|
||||
val copy : 'a t -> 'a t
|
||||
(** Return a copy of the given stack. *)
|
||||
val copy: 'a t -> 'a t
|
||||
|
||||
val length : 'a t -> int
|
||||
(** Return the number of elements in a stack. *)
|
||||
val length: 'a t -> int
|
||||
|
||||
val iter : ('a -> unit) -> 'a t -> unit
|
||||
(** [iter f s] applies [f] in turn to all elements of [s],
|
||||
from the element at the top of the stack to the element at the
|
||||
bottom of the stack. The stack itself is unchanged. *)
|
||||
val iter: ('a -> unit) -> 'a t -> unit
|
||||
|
||||
|
|
|
@ -21,110 +21,114 @@
|
|||
in [arrayLabels.mli], [listLabels.mli] and [stringLabels.mli].
|
||||
*)
|
||||
|
||||
module Array : sig
|
||||
external length : 'a array -> int = "%array_length"
|
||||
external get : 'a array -> int -> 'a = "%array_safe_get"
|
||||
external set : 'a array -> int -> 'a -> unit = "%array_safe_set"
|
||||
external make : int -> 'a -> 'a array = "make_vect"
|
||||
external create : int -> 'a -> 'a array = "make_vect"
|
||||
val init : int -> f:(int -> 'a) -> 'a array
|
||||
val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
|
||||
val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
|
||||
val append : 'a array -> 'a array -> 'a array
|
||||
val concat : 'a array list -> 'a array
|
||||
val sub : 'a array -> pos:int -> len:int -> 'a array
|
||||
val copy : 'a array -> 'a array
|
||||
val fill : 'a array -> pos:int -> len:int -> 'a -> unit
|
||||
val blit :
|
||||
src:'a array -> src_pos:int ->
|
||||
dst:'a array -> dst_pos:int -> len:int -> unit
|
||||
val to_list : 'a array -> 'a list
|
||||
val of_list : 'a list -> 'a array
|
||||
val iter : f:('a -> unit) -> 'a array -> unit
|
||||
val map : f:('a -> 'b) -> 'a array -> 'b array
|
||||
val iteri : f:(int -> 'a -> unit) -> 'a array -> unit
|
||||
val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array
|
||||
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b array -> 'a
|
||||
val fold_right : f:('a -> 'b -> 'b) -> 'a array -> init:'b -> 'b
|
||||
val sort : cmp:('a -> 'a -> int) -> 'a array -> unit
|
||||
val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit
|
||||
external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get"
|
||||
external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set"
|
||||
end
|
||||
module Array :
|
||||
sig
|
||||
external length : 'a array -> int = "%array_length"
|
||||
external get : 'a array -> int -> 'a = "%array_safe_get"
|
||||
external set : 'a array -> int -> 'a -> unit = "%array_safe_set"
|
||||
external make : int -> 'a -> 'a array = "make_vect"
|
||||
external create : int -> 'a -> 'a array = "make_vect"
|
||||
val init : int -> f:(int -> 'a) -> 'a array
|
||||
val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
|
||||
val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
|
||||
val append : 'a array -> 'a array -> 'a array
|
||||
val concat : 'a array list -> 'a array
|
||||
val sub : 'a array -> pos:int -> len:int -> 'a array
|
||||
val copy : 'a array -> 'a array
|
||||
val fill : 'a array -> pos:int -> len:int -> 'a -> unit
|
||||
val blit :
|
||||
src:'a array -> src_pos:int -> dst:'a array -> dst_pos:int -> len:int ->
|
||||
unit
|
||||
val to_list : 'a array -> 'a list
|
||||
val of_list : 'a list -> 'a array
|
||||
val iter : f:('a -> unit) -> 'a array -> unit
|
||||
val map : f:('a -> 'b) -> 'a array -> 'b array
|
||||
val iteri : f:(int -> 'a -> unit) -> 'a array -> unit
|
||||
val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array
|
||||
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b array -> 'a
|
||||
val fold_right : f:('a -> 'b -> 'b) -> 'a array -> init:'b -> 'b
|
||||
val sort : cmp:('a -> 'a -> int) -> 'a array -> unit
|
||||
val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit
|
||||
external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get"
|
||||
external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set"
|
||||
end
|
||||
|
||||
module List : sig
|
||||
val length : 'a list -> int
|
||||
val hd : 'a list -> 'a
|
||||
val tl : 'a list -> 'a list
|
||||
val nth : 'a list -> int -> 'a
|
||||
val rev : 'a list -> 'a list
|
||||
val append : 'a list -> 'a list -> 'a list
|
||||
val rev_append : 'a list -> 'a list -> 'a list
|
||||
val concat : 'a list list -> 'a list
|
||||
val flatten : 'a list list -> 'a list
|
||||
val iter : f:('a -> unit) -> 'a list -> unit
|
||||
val map : f:('a -> 'b) -> 'a list -> 'b list
|
||||
val rev_map : f:('a -> 'b) -> 'a list -> 'b list
|
||||
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b list -> 'a
|
||||
val fold_right : f:('a -> 'b -> 'b) -> 'a list -> init:'b -> 'b
|
||||
val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit
|
||||
val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
val fold_left2 :
|
||||
f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a
|
||||
val fold_right2 :
|
||||
f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c
|
||||
val for_all : f:('a -> bool) -> 'a list -> bool
|
||||
val exists : f:('a -> bool) -> 'a list -> bool
|
||||
val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
val mem : 'a -> set:'a list -> bool
|
||||
val memq : 'a -> set:'a list -> bool
|
||||
val find : f:('a -> bool) -> 'a list -> 'a
|
||||
val filter : f:('a -> bool) -> 'a list -> 'a list
|
||||
val find_all : f:('a -> bool) -> 'a list -> 'a list
|
||||
val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list
|
||||
val assoc : 'a -> ('a * 'b) list -> 'b
|
||||
val assq : 'a -> ('a * 'b) list -> 'b
|
||||
val mem_assoc : 'a -> map:('a * 'b) list -> bool
|
||||
val mem_assq : 'a -> map:('a * 'b) list -> bool
|
||||
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
val split : ('a * 'b) list -> 'a list * 'b list
|
||||
val combine : 'a list -> 'b list -> ('a * 'b) list
|
||||
val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
|
||||
val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
|
||||
end
|
||||
module List :
|
||||
sig
|
||||
val length : 'a list -> int
|
||||
val hd : 'a list -> 'a
|
||||
val tl : 'a list -> 'a list
|
||||
val nth : 'a list -> int -> 'a
|
||||
val rev : 'a list -> 'a list
|
||||
val append : 'a list -> 'a list -> 'a list
|
||||
val rev_append : 'a list -> 'a list -> 'a list
|
||||
val concat : 'a list list -> 'a list
|
||||
val flatten : 'a list list -> 'a list
|
||||
val iter : f:('a -> unit) -> 'a list -> unit
|
||||
val map : f:('a -> 'b) -> 'a list -> 'b list
|
||||
val rev_map : f:('a -> 'b) -> 'a list -> 'b list
|
||||
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b list -> 'a
|
||||
val fold_right : f:('a -> 'b -> 'b) -> 'a list -> init:'b -> 'b
|
||||
val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit
|
||||
val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
|
||||
val fold_left2 :
|
||||
f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a
|
||||
val fold_right2 :
|
||||
f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c
|
||||
val for_all : f:('a -> bool) -> 'a list -> bool
|
||||
val exists : f:('a -> bool) -> 'a list -> bool
|
||||
val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
||||
val mem : 'a -> set:'a list -> bool
|
||||
val memq : 'a -> set:'a list -> bool
|
||||
val find : f:('a -> bool) -> 'a list -> 'a
|
||||
val filter : f:('a -> bool) -> 'a list -> 'a list
|
||||
val find_all : f:('a -> bool) -> 'a list -> 'a list
|
||||
val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list
|
||||
val assoc : 'a -> ('a * 'b) list -> 'b
|
||||
val assq : 'a -> ('a * 'b) list -> 'b
|
||||
val mem_assoc : 'a -> map:('a * 'b) list -> bool
|
||||
val mem_assq : 'a -> map:('a * 'b) list -> bool
|
||||
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
|
||||
val split : ('a * 'b) list -> 'a list * 'b list
|
||||
val combine : 'a list -> 'b list -> ('a * 'b) list
|
||||
val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
|
||||
val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list
|
||||
end
|
||||
|
||||
module String : sig
|
||||
external length : string -> int = "%string_length"
|
||||
external get : string -> int -> char = "%string_safe_get"
|
||||
external set : string -> int -> char -> unit = "%string_safe_set"
|
||||
external create : int -> string = "create_string"
|
||||
val make : int -> char -> string
|
||||
val copy : string -> string
|
||||
val sub : string -> pos:int -> len:int -> string
|
||||
val fill : string -> pos:int -> len:int -> char -> unit
|
||||
val blit :
|
||||
src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int -> unit
|
||||
val concat : sep:string -> string list -> string
|
||||
val escaped : string -> string
|
||||
val index : string -> char -> int
|
||||
val rindex : string -> char -> int
|
||||
val index_from : string -> int -> char -> int
|
||||
val rindex_from : string -> int -> char -> int
|
||||
val contains : string -> char -> bool
|
||||
val contains_from : string -> int -> char -> bool
|
||||
val rcontains_from : string -> int -> char -> bool
|
||||
val uppercase : string -> string
|
||||
val lowercase : string -> string
|
||||
val capitalize : string -> string
|
||||
val uncapitalize : string -> string
|
||||
external unsafe_get : string -> int -> char = "%string_unsafe_get"
|
||||
external unsafe_set : string -> int -> char -> unit = "%string_unsafe_set"
|
||||
external unsafe_blit :
|
||||
src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int -> unit
|
||||
= "blit_string" "noalloc"
|
||||
external unsafe_fill : string -> pos:int -> len:int -> char -> unit
|
||||
= "fill_string" "noalloc"
|
||||
end
|
||||
module String :
|
||||
sig
|
||||
external length : string -> int = "%string_length"
|
||||
external get : string -> int -> char = "%string_safe_get"
|
||||
external set : string -> int -> char -> unit = "%string_safe_set"
|
||||
external create : int -> string = "create_string"
|
||||
val make : int -> char -> string
|
||||
val copy : string -> string
|
||||
val sub : string -> pos:int -> len:int -> string
|
||||
val fill : string -> pos:int -> len:int -> char -> unit
|
||||
val blit :
|
||||
src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int ->
|
||||
unit
|
||||
val concat : sep:string -> string list -> string
|
||||
val escaped : string -> string
|
||||
val index : string -> char -> int
|
||||
val rindex : string -> char -> int
|
||||
val index_from : string -> int -> char -> int
|
||||
val rindex_from : string -> int -> char -> int
|
||||
val contains : string -> char -> bool
|
||||
val contains_from : string -> int -> char -> bool
|
||||
val rcontains_from : string -> int -> char -> bool
|
||||
val uppercase : string -> string
|
||||
val lowercase : string -> string
|
||||
val capitalize : string -> string
|
||||
val uncapitalize : string -> string
|
||||
external unsafe_get : string -> int -> char = "%string_unsafe_get"
|
||||
external unsafe_set : string -> int -> char -> unit = "%string_unsafe_set"
|
||||
external unsafe_blit :
|
||||
src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int ->
|
||||
unit = "blit_string" "noalloc"
|
||||
external unsafe_fill :
|
||||
string -> pos:int -> len:int -> char -> unit = "fill_string" "noalloc"
|
||||
end
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
|
||||
(** Streams and parsers. *)
|
||||
|
||||
(** The type of streams holding values of type ['a]. *)
|
||||
type 'a t
|
||||
(** The type of streams holding values of type ['a]. *)
|
||||
|
||||
exception Failure
|
||||
(** Raised by parsers when none of the first components of the stream
|
||||
patterns is accepted. *)
|
||||
exception Failure;;
|
||||
|
||||
exception Error of string
|
||||
(** Raised by parsers when the first component of a stream pattern is
|
||||
accepted, but one of the following components is rejected. *)
|
||||
exception Error of string;;
|
||||
|
||||
|
||||
(** {2 Stream builders}
|
||||
|
@ -33,73 +33,73 @@ exception Error of string;;
|
|||
when accessing such mixed streams.
|
||||
*)
|
||||
|
||||
val from : (int -> 'a option) -> 'a t
|
||||
(** [Stream.from f] returns a stream built from the function [f].
|
||||
To create a new stream element, the function [f] is called with
|
||||
the current stream count. The user function [f] must return either
|
||||
[Some <value>] for a value or [None] to specify the end of the
|
||||
stream. *)
|
||||
val from : (int -> 'a option) -> 'a t;;
|
||||
|
||||
val of_list : 'a list -> 'a t
|
||||
(** Return the stream holding the elements of the list in the same
|
||||
order. *)
|
||||
val of_list : 'a list -> 'a t;;
|
||||
|
||||
val of_string : string -> char t
|
||||
(** Return the stream of the characters of the string parameter. *)
|
||||
val of_string : string -> char t;;
|
||||
|
||||
val of_channel : in_channel -> char t
|
||||
(** Return the stream of the characters read from the input channel. *)
|
||||
val of_channel : in_channel -> char t;;
|
||||
|
||||
|
||||
(** {2 Stream iterator} *)
|
||||
|
||||
val iter : ('a -> unit) -> 'a t -> unit
|
||||
(** [Stream.iter f s] scans the whole stream s, applying function [f]
|
||||
in turn to each stream element encountered. *)
|
||||
val iter : ('a -> unit) -> 'a t -> unit;;
|
||||
|
||||
|
||||
(** {2 Predefined parsers} *)
|
||||
|
||||
val next : 'a t -> 'a
|
||||
(** Return the first element of the stream and remove it from the
|
||||
stream. Raise Stream.Failure if the stream is empty. *)
|
||||
val next : 'a t -> 'a;;
|
||||
|
||||
val empty : 'a t -> unit
|
||||
(** Return [()] if the stream is empty, else raise [Stream.Failure]. *)
|
||||
val empty : 'a t -> unit;;
|
||||
|
||||
|
||||
(** {2 Useful functions} *)
|
||||
|
||||
val peek : 'a t -> 'a option
|
||||
(** Return [Some] of "the first element" of the stream, or [None] if
|
||||
the stream is empty. *)
|
||||
val peek : 'a t -> 'a option;;
|
||||
|
||||
val junk : 'a t -> unit
|
||||
(** Remove the first element of the stream, possibly unfreezing
|
||||
it before. *)
|
||||
val junk : 'a t -> unit;;
|
||||
|
||||
val count : 'a t -> int
|
||||
(** Return the current count of the stream elements, i.e. the number
|
||||
of the stream elements discarded. *)
|
||||
val count : 'a t -> int;;
|
||||
|
||||
val npeek : int -> 'a t -> 'a list
|
||||
(** [npeek n] returns the list of the [n] first elements of
|
||||
the stream, or all its remaining elements if less than [n]
|
||||
elements are available. *)
|
||||
val npeek : int -> 'a t -> 'a list;;
|
||||
|
||||
(**/**)
|
||||
|
||||
(** {2 For system use only, not for the casual user} *)
|
||||
|
||||
val iapp : 'a t -> 'a t -> 'a t;;
|
||||
val icons : 'a -> 'a t -> 'a t;;
|
||||
val ising : 'a -> 'a t;;
|
||||
val iapp : 'a t -> 'a t -> 'a t
|
||||
val icons : 'a -> 'a t -> 'a t
|
||||
val ising : 'a -> 'a t
|
||||
|
||||
val lapp : (unit -> 'a t) -> 'a t -> 'a t;;
|
||||
val lcons : (unit -> 'a) -> 'a t -> 'a t;;
|
||||
val lsing : (unit -> 'a) -> 'a t;;
|
||||
val lapp : (unit -> 'a t) -> 'a t -> 'a t
|
||||
val lcons : (unit -> 'a) -> 'a t -> 'a t
|
||||
val lsing : (unit -> 'a) -> 'a t
|
||||
|
||||
val sempty : 'a t;;
|
||||
val slazy : (unit -> 'a t) -> 'a t;;
|
||||
val sempty : 'a t
|
||||
val slazy : (unit -> 'a t) -> 'a t
|
||||
|
||||
val dump : ('a -> unit) -> 'a t -> unit;;
|
||||
val dump : ('a -> unit) -> 'a t -> unit
|
||||
|
|
|
@ -14,53 +14,54 @@
|
|||
|
||||
(** String operations. *)
|
||||
|
||||
(** Return the length (number of characters) of the given string. *)
|
||||
external length : string -> int = "%string_length"
|
||||
(** Return the length (number of characters) of the given string. *)
|
||||
|
||||
external get : string -> int -> char = "%string_safe_get"
|
||||
(** [String.get s n] returns character number [n] in string [s].
|
||||
The first character is character number 0.
|
||||
The last character is character number [String.length s - 1].
|
||||
Raise [Invalid_argument] if [n] is outside the range
|
||||
0 to [(String.length s - 1)].
|
||||
You can also write [s.[n]] instead of [String.get s n]. *)
|
||||
external get : string -> int -> char = "%string_safe_get"
|
||||
|
||||
external set : string -> int -> char -> unit = "%string_safe_set"
|
||||
(** [String.set s n c] modifies string [s] in place,
|
||||
replacing the character number [n] by [c].
|
||||
Raise [Invalid_argument] if [n] is outside the range
|
||||
0 to [(String.length s - 1)].
|
||||
You can also write [s.[n] <- c] instead of [String.set s n c]. *)
|
||||
external set : string -> int -> char -> unit = "%string_safe_set"
|
||||
|
||||
external create : int -> string = "create_string"
|
||||
(** [String.create n] returns a fresh string of length [n].
|
||||
The string initially contains arbitrary characters.
|
||||
Raise [Invalid_argument] if [n < 0] or [n > Sys.max_string_length].
|
||||
*)
|
||||
external create : int -> string = "create_string"
|
||||
|
||||
val make : int -> char -> string
|
||||
(** [String.make n c] returns a fresh string of length [n],
|
||||
filled with the character [c].
|
||||
Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}.*)
|
||||
val make : int -> char -> string
|
||||
|
||||
(** Return a copy of the given string. *)
|
||||
val copy : string -> string
|
||||
(** Return a copy of the given string. *)
|
||||
|
||||
val sub : string -> int -> int -> string
|
||||
(** [String.sub s start len] returns a fresh string of length [len],
|
||||
containing the characters number [start] to [start + len - 1]
|
||||
of string [s].
|
||||
Raise [Invalid_argument] if [start] and [len] do not
|
||||
designate a valid substring of [s]; that is, if [start < 0],
|
||||
or [len < 0], or [start + len > ]{!String.length}[ s]. *)
|
||||
val sub : string -> int -> int -> string
|
||||
|
||||
val fill : string -> int -> int -> char -> unit
|
||||
(** [String.fill s start len c] modifies string [s] in place,
|
||||
replacing the characters number [start] to [start + len - 1]
|
||||
by [c].
|
||||
Raise [Invalid_argument] if [start] and [len] do not
|
||||
designate a valid substring of [s]. *)
|
||||
val fill : string -> int -> int -> char -> unit
|
||||
|
||||
val blit : string -> int -> string -> int -> int -> unit
|
||||
(** [String.blit src srcoff dst dstoff len] copies [len] characters
|
||||
from string [src], starting at character number [srcoff], to
|
||||
string [dst], starting at character number [dstoff]. It works
|
||||
|
@ -69,84 +70,82 @@ val fill : string -> int -> int -> char -> unit
|
|||
Raise [Invalid_argument] if [srcoff] and [len] do not
|
||||
designate a valid substring of [src], or if [dstoff] and [len]
|
||||
do not designate a valid substring of [dst]. *)
|
||||
val blit : string -> int -> string -> int -> int -> unit
|
||||
|
||||
val concat : string -> string list -> string
|
||||
(** [String.concat sep sl] catenates the list of strings [sl],
|
||||
inserting the separator string [sep] between each. *)
|
||||
val concat : string -> string list -> string
|
||||
|
||||
val iter : (char -> unit) -> string -> unit
|
||||
(** [String.iter f s] applies function [f] in turn to all
|
||||
the characters of [s]. It is equivalent to
|
||||
[f s.(0); f s.(1); ...; f s.(String.length s - 1); ()]. *)
|
||||
val iter : (char -> unit) -> string -> unit
|
||||
|
||||
val escaped : string -> string
|
||||
(** Return a copy of the argument, with special characters
|
||||
represented by escape sequences, following the lexical
|
||||
conventions of Objective Caml. If there is no special
|
||||
character in the argument, return the original string itself,
|
||||
not a copy. *)
|
||||
val escaped: string -> string
|
||||
|
||||
val index : string -> char -> int
|
||||
(** [String.index s c] returns the position of the leftmost
|
||||
occurrence of character [c] in string [s].
|
||||
Raise [Not_found] if [c] does not occur in [s]. *)
|
||||
val index: string -> char -> int
|
||||
|
||||
val rindex : string -> char -> int
|
||||
(** [String.rindex s c] returns the position of the rightmost
|
||||
occurrence of character [c] in string [s].
|
||||
Raise [Not_found] if [c] does not occur in [s]. *)
|
||||
val rindex: string -> char -> int
|
||||
|
||||
val index_from : string -> int -> char -> int
|
||||
(** Same as {!String.index}, but start
|
||||
searching at the character position given as second argument.
|
||||
[String.index s c] is equivalent to [String.index_from s 0 c].*)
|
||||
val index_from: string -> int -> char -> int
|
||||
|
||||
val rindex_from : string -> int -> char -> int
|
||||
(** Same as {!String.rindex}, but start
|
||||
searching at the character position given as second argument.
|
||||
[String.rindex s c] is equivalent to
|
||||
[String.rindex_from s (String.length s - 1) c]. *)
|
||||
val rindex_from: string -> int -> char -> int
|
||||
|
||||
|
||||
val contains : string -> char -> bool
|
||||
(** [String.contains s c] tests if character [c]
|
||||
appears in the string [s]. *)
|
||||
val contains : string -> char -> bool
|
||||
|
||||
val contains_from : string -> int -> char -> bool
|
||||
(** [String.contains_from s start c] tests if character [c]
|
||||
appears in the substring of [s] starting from [start] to the end
|
||||
of [s].
|
||||
Raise [Invalid_argument] if [start] is not a valid index of [s]. *)
|
||||
val contains_from : string -> int -> char -> bool
|
||||
|
||||
val rcontains_from : string -> int -> char -> bool
|
||||
(** [String.rcontains_from s stop c] tests if character [c]
|
||||
appears in the substring of [s] starting from the beginning
|
||||
of [s] to index [stop].
|
||||
Raise [Invalid_argument] if [stop] is not a valid index of [s]. *)
|
||||
val rcontains_from : string -> int -> char -> bool
|
||||
|
||||
val uppercase : string -> string
|
||||
(** Return a copy of the argument, with all lowercase letters
|
||||
translated to uppercase, including accented letters of the ISO
|
||||
Latin-1 (8859-1) character set. *)
|
||||
val uppercase: string -> string
|
||||
|
||||
val lowercase : string -> string
|
||||
(** Return a copy of the argument, with all uppercase letters
|
||||
translated to lowercase, including accented letters of the ISO
|
||||
Latin-1 (8859-1) character set. *)
|
||||
val lowercase: string -> string
|
||||
|
||||
val capitalize : string -> string
|
||||
(** Return a copy of the argument, with the first letter set to uppercase. *)
|
||||
val capitalize: string -> string
|
||||
|
||||
val uncapitalize : string -> string
|
||||
(** Return a copy of the argument, with the first letter set to lowercase. *)
|
||||
val uncapitalize: string -> string
|
||||
|
||||
|
||||
(**/**)
|
||||
|
||||
external unsafe_get : string -> int -> char = "%string_unsafe_get"
|
||||
external unsafe_set : string -> int -> char -> unit = "%string_unsafe_set"
|
||||
external unsafe_blit : string -> int -> string -> int -> int -> unit
|
||||
= "blit_string" "noalloc"
|
||||
external unsafe_fill : string -> int -> int -> char -> unit
|
||||
= "fill_string" "noalloc"
|
||||
external unsafe_blit :
|
||||
string -> int -> string -> int -> int -> unit = "blit_string" "noalloc"
|
||||
external unsafe_fill :
|
||||
string -> int -> int -> char -> unit = "fill_string" "noalloc"
|
||||
|
|
|
@ -14,53 +14,55 @@
|
|||
|
||||
(** String operations. *)
|
||||
|
||||
(** Return the length (number of characters) of the given string. *)
|
||||
external length : string -> int = "%string_length"
|
||||
(** Return the length (number of characters) of the given string. *)
|
||||
|
||||
external get : string -> int -> char = "%string_safe_get"
|
||||
(** [String.get s n] returns character number [n] in string [s].
|
||||
The first character is character number 0.
|
||||
The last character is character number [String.length s - 1].
|
||||
Raise [Invalid_argument] if [n] is outside the range
|
||||
0 to [(String.length s - 1)].
|
||||
You can also write [s.[n]] instead of [String.get s n]. *)
|
||||
external get : string -> int -> char = "%string_safe_get"
|
||||
|
||||
external set : string -> int -> char -> unit = "%string_safe_set"
|
||||
(** [String.set s n c] modifies string [s] in place,
|
||||
replacing the character number [n] by [c].
|
||||
Raise [Invalid_argument] if [n] is outside the range
|
||||
0 to [(String.length s - 1)].
|
||||
You can also write [s.[n] <- c] instead of [String.set s n c]. *)
|
||||
external set : string -> int -> char -> unit = "%string_safe_set"
|
||||
|
||||
external create : int -> string = "create_string"
|
||||
(** [String.create n] returns a fresh string of length [n].
|
||||
The string initially contains arbitrary characters.
|
||||
Raise [Invalid_argument] if [n < 0] or [n > Sys.max_string_length].
|
||||
*)
|
||||
external create : int -> string = "create_string"
|
||||
|
||||
val make : int -> char -> string
|
||||
(** [String.make n c] returns a fresh string of length [n],
|
||||
filled with the character [c].
|
||||
Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}.*)
|
||||
val make : int -> char -> string
|
||||
|
||||
(** Return a copy of the given string. *)
|
||||
val copy : string -> string
|
||||
(** Return a copy of the given string. *)
|
||||
|
||||
val sub : string -> pos:int -> len:int -> string
|
||||
(** [String.sub s start len] returns a fresh string of length [len],
|
||||
containing the characters number [start] to [start + len - 1]
|
||||
of string [s].
|
||||
Raise [Invalid_argument] if [start] and [len] do not
|
||||
designate a valid substring of [s]; that is, if [start < 0],
|
||||
or [len < 0], or [start + len > ]{!StringLabels.length}[ s]. *)
|
||||
val sub : string -> pos:int -> len:int -> string
|
||||
|
||||
val fill : string -> pos:int -> len:int -> char -> unit
|
||||
(** [String.fill s start len c] modifies string [s] in place,
|
||||
replacing the characters number [start] to [start + len - 1]
|
||||
by [c].
|
||||
Raise [Invalid_argument] if [start] and [len] do not
|
||||
designate a valid substring of [s]. *)
|
||||
val fill : string -> pos:int -> len:int -> char -> unit
|
||||
|
||||
val blit :
|
||||
src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int -> unit
|
||||
(** [String.blit src srcoff dst dstoff len] copies [len] characters
|
||||
from string [src], starting at character number [srcoff], to
|
||||
string [dst], starting at character number [dstoff]. It works
|
||||
|
@ -69,77 +71,75 @@ val fill : string -> pos:int -> len:int -> char -> unit
|
|||
Raise [Invalid_argument] if [srcoff] and [len] do not
|
||||
designate a valid substring of [src], or if [dstoff] and [len]
|
||||
do not designate a valid substring of [dst]. *)
|
||||
val blit : src:string -> src_pos:int ->
|
||||
dst:string -> dst_pos:int -> len:int -> unit
|
||||
|
||||
val concat : sep:string -> string list -> string
|
||||
(** [String.concat sep sl] catenates the list of strings [sl],
|
||||
inserting the separator string [sep] between each. *)
|
||||
val concat : sep:string -> string list -> string
|
||||
|
||||
val iter : f:(char -> unit) -> string -> unit
|
||||
(** [String.iter f s] applies function [f] in turn to all
|
||||
the characters of [s]. It is equivalent to
|
||||
[f s.(0); f s.(1); ...; f s.(String.length s - 1); ()]. *)
|
||||
val iter : f:(char -> unit) -> string -> unit
|
||||
|
||||
val escaped : string -> string
|
||||
(** Return a copy of the argument, with special characters
|
||||
represented by escape sequences, following the lexical
|
||||
conventions of Objective Caml. If there is no special
|
||||
character in the argument, return the original string itself,
|
||||
not a copy. *)
|
||||
val escaped: string -> string
|
||||
|
||||
val index : string -> char -> int
|
||||
(** [String.index s c] returns the position of the leftmost
|
||||
occurrence of character [c] in string [s].
|
||||
Raise [Not_found] if [c] does not occur in [s]. *)
|
||||
val index: string -> char -> int
|
||||
|
||||
val rindex : string -> char -> int
|
||||
(** [String.rindex s c] returns the position of the rightmost
|
||||
occurrence of character [c] in string [s].
|
||||
Raise [Not_found] if [c] does not occur in [s]. *)
|
||||
val rindex: string -> char -> int
|
||||
|
||||
val index_from : string -> int -> char -> int
|
||||
(** Same as {!StringLabels.index}, but start
|
||||
searching at the character position given as second argument.
|
||||
[String.index s c] is equivalent to [String.index_from s 0 c].*)
|
||||
val index_from: string -> int -> char -> int
|
||||
|
||||
val rindex_from : string -> int -> char -> int
|
||||
(** Same as {!StringLabels.rindex}, but start
|
||||
searching at the character position given as second argument.
|
||||
[String.rindex s c] is equivalent to
|
||||
[String.rindex_from s (String.length s - 1) c]. *)
|
||||
val rindex_from: string -> int -> char -> int
|
||||
|
||||
val contains : string -> char -> bool
|
||||
(** [String.contains s c] tests if character [c]
|
||||
appears in the string [s]. *)
|
||||
val contains : string -> char -> bool
|
||||
|
||||
val contains_from : string -> int -> char -> bool
|
||||
(** [String.contains_from s start c] tests if character [c]
|
||||
appears in the substring of [s] starting from [start] to the end
|
||||
of [s].
|
||||
Raise [Invalid_argument] if [start] is not a valid index of [s]. *)
|
||||
val contains_from : string -> int -> char -> bool
|
||||
|
||||
val rcontains_from : string -> int -> char -> bool
|
||||
(** [String.rcontains_from s stop c] tests if character [c]
|
||||
appears in the substring of [s] starting from the beginning
|
||||
of [s] to index [stop].
|
||||
Raise [Invalid_argument] if [stop] is not a valid index of [s]. *)
|
||||
val rcontains_from : string -> int -> char -> bool
|
||||
|
||||
val uppercase : string -> string
|
||||
(** Return a copy of the argument, with all lowercase letters
|
||||
translated to uppercase, including accented letters of the ISO
|
||||
Latin-1 (8859-1) character set. *)
|
||||
val uppercase: string -> string
|
||||
|
||||
val lowercase : string -> string
|
||||
(** Return a copy of the argument, with all uppercase letters
|
||||
translated to lowercase, including accented letters of the ISO
|
||||
Latin-1 (8859-1) character set. *)
|
||||
val lowercase: string -> string
|
||||
|
||||
val capitalize : string -> string
|
||||
(** Return a copy of the argument, with the first letter set to uppercase. *)
|
||||
val capitalize: string -> string
|
||||
|
||||
val uncapitalize : string -> string
|
||||
(** Return a copy of the argument, with the first letter set to lowercase. *)
|
||||
val uncapitalize: string -> string
|
||||
|
||||
|
||||
(**/**)
|
||||
|
@ -147,8 +147,7 @@ val uncapitalize: string -> string
|
|||
external unsafe_get : string -> int -> char = "%string_unsafe_get"
|
||||
external unsafe_set : string -> int -> char -> unit = "%string_unsafe_set"
|
||||
external unsafe_blit :
|
||||
src:string -> src_pos:int ->
|
||||
dst:string -> dst_pos:int -> len:int -> unit
|
||||
= "blit_string" "noalloc"
|
||||
external unsafe_fill : string -> pos:int -> len:int -> char -> unit
|
||||
= "fill_string" "noalloc"
|
||||
src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int ->
|
||||
unit = "blit_string" "noalloc"
|
||||
external unsafe_fill :
|
||||
string -> pos:int -> len:int -> char -> unit = "fill_string" "noalloc"
|
||||
|
|
109
stdlib/sys.mli
109
stdlib/sys.mli
|
@ -14,138 +14,157 @@
|
|||
|
||||
(** System interface. *)
|
||||
|
||||
val argv : string array
|
||||
(** The command line arguments given to the process.
|
||||
The first element is the command name used to invoke the program.
|
||||
The following elements are the command-line arguments
|
||||
given to the program. *)
|
||||
val argv: string array
|
||||
|
||||
external file_exists : string -> bool = "sys_file_exists"
|
||||
(** Test if a file with the given name exists. *)
|
||||
external file_exists: string -> bool = "sys_file_exists"
|
||||
|
||||
external remove : string -> unit = "sys_remove"
|
||||
(** Remove the given file name from the file system. *)
|
||||
external remove: string -> unit = "sys_remove"
|
||||
|
||||
external rename : string -> string -> unit = "sys_rename"
|
||||
(** Rename a file. The first argument is the old name and the
|
||||
second is the new name. *)
|
||||
external rename: string -> string -> unit = "sys_rename"
|
||||
|
||||
external getenv : string -> string = "sys_getenv"
|
||||
(** Return the value associated to a variable in the process
|
||||
environment. Raise [Not_found] if the variable is unbound. *)
|
||||
external getenv: string -> string = "sys_getenv"
|
||||
|
||||
external command : string -> int = "sys_system_command"
|
||||
(** Execute the given shell command and return its exit code. *)
|
||||
external command: string -> int = "sys_system_command"
|
||||
|
||||
external time : unit -> float = "sys_time"
|
||||
(** Return the processor time, in seconds, used by the program
|
||||
since the beginning of execution. *)
|
||||
external time: unit -> float = "sys_time"
|
||||
|
||||
external chdir : string -> unit = "sys_chdir"
|
||||
(** Change the current working directory of the process. *)
|
||||
external chdir: string -> unit = "sys_chdir"
|
||||
|
||||
external getcwd : unit -> string = "sys_getcwd"
|
||||
(** Return the current working directory of the process. *)
|
||||
external getcwd: unit -> string = "sys_getcwd"
|
||||
|
||||
val interactive : bool ref
|
||||
(** This reference is initially set to [false] in standalone
|
||||
programs and to [true] if the code is being executed under
|
||||
the interactive toplevel system [ocaml]. *)
|
||||
val interactive: bool ref
|
||||
|
||||
val os_type : string
|
||||
(** Operating system currently executing the Caml program.
|
||||
One of ["Unix"], ["Win32"], ["Cygwin"] or ["MacOS"]. *)
|
||||
val os_type: string
|
||||
|
||||
val word_size : int
|
||||
(** Size of one word on the machine currently executing the Caml
|
||||
program, in bits: 32 or 64. *)
|
||||
val word_size: int
|
||||
|
||||
val max_string_length : int
|
||||
(** Maximum length of a string. *)
|
||||
val max_string_length: int
|
||||
|
||||
val max_array_length : int
|
||||
(** Maximum length of an array. *)
|
||||
val max_array_length: int
|
||||
|
||||
|
||||
(** {2 Signal handling} *)
|
||||
|
||||
|
||||
type signal_behavior =
|
||||
Signal_default
|
||||
| Signal_ignore
|
||||
| Signal_handle of (int -> unit)
|
||||
(** What to do when receiving a signal:
|
||||
- [Signal_default]: take the default behavior
|
||||
(usually: abort the program)
|
||||
- [Signal_ignore]: ignore the signal
|
||||
- [Signal_handle f]: call function [f], giving it the signal
|
||||
number as argument. *)
|
||||
type signal_behavior =
|
||||
Signal_default
|
||||
| Signal_ignore
|
||||
| Signal_handle of (int -> unit)
|
||||
|
||||
|
||||
external signal :
|
||||
int -> signal_behavior -> signal_behavior = "install_signal_handler"
|
||||
(** Set the behavior of the system on receipt of a given signal.
|
||||
The first argument is the signal number. Return the behavior
|
||||
previously associated with the signal. *)
|
||||
external signal: int -> signal_behavior -> signal_behavior
|
||||
= "install_signal_handler"
|
||||
|
||||
val set_signal : int -> signal_behavior -> unit
|
||||
(** Same as {!Sys.signal} but return value is ignored. *)
|
||||
val set_signal: int -> signal_behavior -> unit
|
||||
|
||||
|
||||
(** {3 Signal numbers for the standard POSIX signals.} *)
|
||||
|
||||
val sigabrt : int
|
||||
(** Abnormal termination *)
|
||||
val sigabrt: int
|
||||
|
||||
val sigalrm : int
|
||||
(** Timeout *)
|
||||
val sigalrm: int
|
||||
|
||||
val sigfpe : int
|
||||
(** Arithmetic exception *)
|
||||
val sigfpe: int
|
||||
|
||||
val sighup : int
|
||||
(** Hangup on controlling terminal *)
|
||||
val sighup: int
|
||||
|
||||
val sigill : int
|
||||
(** Invalid hardware instruction *)
|
||||
val sigill: int
|
||||
|
||||
val sigint : int
|
||||
(** Interactive interrupt (ctrl-C) *)
|
||||
val sigint: int
|
||||
|
||||
val sigkill : int
|
||||
(** Termination (cannot be ignored) *)
|
||||
val sigkill: int
|
||||
|
||||
val sigpipe : int
|
||||
(** Broken pipe *)
|
||||
val sigpipe: int
|
||||
|
||||
val sigquit : int
|
||||
(** Interactive termination *)
|
||||
val sigquit: int
|
||||
|
||||
val sigsegv : int
|
||||
(** Invalid memory reference *)
|
||||
val sigsegv: int
|
||||
|
||||
val sigterm : int
|
||||
(** Termination *)
|
||||
val sigterm: int
|
||||
|
||||
val sigusr1 : int
|
||||
(** Application-defined signal 1 *)
|
||||
val sigusr1: int
|
||||
|
||||
val sigusr2 : int
|
||||
(** Application-defined signal 2 *)
|
||||
val sigusr2: int
|
||||
|
||||
val sigchld : int
|
||||
(** Child process terminated *)
|
||||
val sigchld: int
|
||||
|
||||
val sigcont : int
|
||||
(** Continue *)
|
||||
val sigcont: int
|
||||
|
||||
val sigstop : int
|
||||
(** Stop *)
|
||||
val sigstop: int
|
||||
|
||||
val sigtstp : int
|
||||
(** Interactive stop *)
|
||||
val sigtstp: int
|
||||
|
||||
val sigttin : int
|
||||
(** Terminal read from background process *)
|
||||
val sigttin: int
|
||||
|
||||
val sigttou : int
|
||||
(** Terminal write from background process *)
|
||||
val sigttou: int
|
||||
|
||||
val sigvtalrm : int
|
||||
(** Timeout in virtual time *)
|
||||
val sigvtalrm: int
|
||||
|
||||
val sigprof : int
|
||||
(** Profiling interrupt *)
|
||||
val sigprof: int
|
||||
|
||||
|
||||
exception Break
|
||||
(** Exception raised on interactive interrupt if {!Sys.catch_break}
|
||||
is on. *)
|
||||
exception Break
|
||||
|
||||
|
||||
val catch_break : bool -> unit
|
||||
(** [catch_break] governs whether interactive interrupt (ctrl-C)
|
||||
terminates the program or raises the [Break] exception.
|
||||
Call [catch_break true] to enable raising [Break],
|
||||
and [catch_break false] to let the system
|
||||
terminate the program on user interrupt. *)
|
||||
val catch_break: bool -> unit
|
||||
|
|
|
@ -14,36 +14,37 @@
|
|||
|
||||
(** Arrays of weak pointers. *)
|
||||
|
||||
type 'a t
|
||||
(** The type of arrays of weak pointers (weak arrays). A weak
|
||||
pointer is a value that the garbage collector may erase at
|
||||
any time.
|
||||
A weak pointer is said to be full if it points to a value,
|
||||
empty if the value was erased by the GC.*)
|
||||
type 'a t;;
|
||||
|
||||
|
||||
val create : int -> 'a t
|
||||
(** [Weak.create n] returns a new weak array of length [n].
|
||||
All the pointers are initially empty. Raise [Invalid_argument]
|
||||
if [n] is negative or greater than {!Sys.max_array_length}[-1].*)
|
||||
val create : int -> 'a t;;
|
||||
|
||||
val length : 'a t -> int
|
||||
(** [Weak.length ar] returns the length (number of elements) of
|
||||
[ar].*)
|
||||
val length : 'a t -> int;;
|
||||
|
||||
val set : 'a t -> int -> 'a option -> unit
|
||||
(** [Weak.set ar n (Some el)] sets the [n]th cell of [ar] to be a
|
||||
(full) pointer to [el]; [Weak.set ar n None] sets the [n]th
|
||||
cell of [ar] to empty.
|
||||
Raise [Invalid_argument "Weak.set"] if [n] is not in the range
|
||||
0 to {!Weak.length}[ a - 1].*)
|
||||
val set : 'a t -> int -> 'a option -> unit;;
|
||||
|
||||
val get : 'a t -> int -> 'a option
|
||||
(** [Weak.get ar n] returns None if the [n]th cell of [ar] is
|
||||
empty, [Some x] (where [x] is the value) if it is full.
|
||||
Raise [Invalid_argument "Weak.get"] if [n] is not in the range
|
||||
0 to {!Weak.length}[ a - 1].*)
|
||||
val get : 'a t -> int -> 'a option;;
|
||||
|
||||
val get_copy : 'a t -> int -> 'a option
|
||||
(** [Weak.get_copy ar n] returns None if the [n]th cell of [ar] is
|
||||
empty, [Some x] (where [x] is a (shallow) copy of the value) if
|
||||
it is full.
|
||||
|
@ -53,24 +54,23 @@ val get : 'a t -> int -> 'a option;;
|
|||
([get] may delay the erasure to the next GC cycle).
|
||||
Raise [Invalid_argument "Weak.get"] if [n] is not in the range
|
||||
0 to {!Weak.length}[ a - 1].*)
|
||||
val get_copy : 'a t -> int -> 'a option;;
|
||||
|
||||
|
||||
val check : 'a t -> int -> bool
|
||||
(** [Weak.check ar n] returns [true] if the [n]th cell of [ar] is
|
||||
full, [false] if it is empty. Note that even if [Weak.check ar n]
|
||||
returns [true], a subsequent {!Weak.get}[ ar n] can return [None].*)
|
||||
val check: 'a t -> int -> bool;;
|
||||
|
||||
val fill : 'a t -> int -> int -> 'a option -> unit
|
||||
(** [Weak.fill ar ofs len el] sets to [el] all pointers of [ar] from
|
||||
[ofs] to [ofs + len - 1]. Raise [Invalid_argument "Weak.fill"]
|
||||
if [ofs] and [len] do not designate a valid subarray of [a].*)
|
||||
val fill: 'a t -> int -> int -> 'a option -> unit;;
|
||||
|
||||
val blit : 'a t -> int -> 'a t -> int -> int -> unit
|
||||
(** [Weak.blit ar1 off1 ar2 off2 len] copies [len] weak pointers
|
||||
from [ar1] (starting at [off1]) to [ar2] (starting at [off2]).
|
||||
It works correctly even if [ar1] and [ar2] are the same.
|
||||
Raise [Invalid_argument "Weak.blit"] if [off1] and [len] do
|
||||
not designate a valid subarray of [ar1], or if [off2] and [len]
|
||||
do not designate a valid subarray of [ar2].*)
|
||||
val blit : 'a t -> int -> 'a t -> int -> int -> unit;;
|
||||
|
||||
|
|
Loading…
Reference in New Issue