A1val empty : 'a tThe empty array.
val of_array : 'a array -> 'a t(of_array a) converts a 0-based 'a array to an 'a t.
val (!) : 'a array -> 'a t! is of_array.
The following functions all use 1-based indexing where OCaml's Array uses 0-based indexing.
val get : 'a t -> int -> 'a(get a n) is the element number n of array a.
The first element has number 1. The last element has number (len a).
Raise (Invalid_argument _) if n is outside the range 1 to (len a).
Examples:
(get [|1|] 1) = 1(get [|1|] 0) raises (Invalid_argument _)val set : 'a t -> int -> 'a -> unit(set a n x) modifies array a in place, replacing element number n with x.
Raise (Invalid_argument _) if n is outside the range 1 to (len a).
val init : int -> (int -> 'a) -> 'a t(init n f) returns a fresh array of length n, with element number i initialized to the result of (f i).
Raise Invalid_argument if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.
val iteri : (int -> 'a -> unit) -> 'a t -> unit(iteri f a) is the same as iter, but the function is applied with the 1-based index of the element as first argument, and the element itself as second argument.
(mapi f a) is the same as map, but the function is applied with the 1-based index of the element as first argument, and the element itself as second argument.
(sub a start len) returns a fresh array of length len, containing the elements number start to start + len - 1 of array a.
Raise Invalid_argument _ if start and len do not designate a valid subarray of a; that is, if start < 0 ||
len < 0 || start + len > len a.
val fill : 'a t -> int -> int -> 'a -> unit(fill a ofs len x) modifies the array a in place, storing x in elements number ofs to ofs + len - 1.
Raise Invalid_argument _ if ofs and len do not designate a valid subarray of a.
(blit v1 o1 v2 o2 len) copies len elements from array v1, starting at element number o1, to array v2, starting at element number o2.
It works correctly even if v1 and v2 are the same array, and the source and destination chunks overlap.
Raise Invalid_argument _ if o1 and len do not designate a valid subarray of v1, or if o2 and len do not designate a valid subarray of v2.
ArrayThe following functions are all exactly those of Array (with Prelude extensions), because they don't involve indexing.
val length : 'a t -> intval len : 'a t -> intval make : int -> 'a -> 'a tval create_float : int -> float tval to_list : 'a t -> 'a listval of_list : 'a list -> 'a tval iter : ('a -> unit) -> 'a t -> unitval fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'aval fold_right : ('b -> 'a -> 'a) -> 'b t -> 'a -> 'aval for_all : ('a -> bool) -> 'a t -> boolval exists : ('a -> bool) -> 'a t -> boolval mem : 'a -> 'a t -> boolval memq : 'a -> 'a t -> boolval sort : ('a -> 'a -> int) -> 'a t -> unitval stable_sort : ('a -> 'a -> int) -> 'a t -> unitval fast_sort : ('a -> 'a -> int) -> 'a t -> unitval foldl : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'aval foldr : ('a -> 'b -> 'b) -> 'b -> 'a t -> 'bval random : ?size:(unit -> int) -> (unit -> 'a) -> unit -> 'a t