Purely functional use of arrays. Update is costly, but reads are very fast. Sadly, it is not possible to make this type covariant without using black magic.
type 'a tArray of values of type 'a. The underlying type really is an array, but it will never be modified.
It should be covariant but OCaml will not accept it.
val empty : 'a tval length : _ t ‑> intval singleton : 'a ‑> 'a tval doubleton : 'a ‑> 'a ‑> 'a tval init : int ‑> (int ‑> 'a) ‑> 'a tinit n f makes the array [| f 0; f 1; ... ; f (n-1) |].
n < 0.sub a start len returns a fresh array of length len, containing the elements
from start to pstart + len - 1 of array a.
Raises Invalid_argument "Array.sub" if start and len do not designate a
valid subarray of a; that is, if start < 0, or len < 0, or start + len > Array.length a.
val iter : ('a ‑> unit) ‑> 'a t ‑> unitval iteri : (int ‑> 'a ‑> unit) ‑> 'a t ‑> unitval foldi : ('a ‑> int ‑> 'b ‑> 'a) ‑> 'a ‑> 'b t ‑> 'aval fold : ('a ‑> 'b ‑> 'a) ‑> 'a ‑> 'b t ‑> 'aval for_all : ('a ‑> bool) ‑> 'a t ‑> boolval exists : ('a ‑> bool) ‑> 'a t ‑> boolval of_list : 'a list ‑> 'a tval to_list : 'a t ‑> 'a listval of_array_unsafe : 'a array ‑> 'a tTake ownership of the given array. Careful, the array must NOT be modified afterwards!