Module type Array_like.S

Array interface.

val immutable : bool

If true the values of the array type are immutable and using set raises Invalid_argument.

type t

The type for arrays.

type elt

The type of elements of the array.

val get : t -> int -> elt

get a i is the ith zero-based element of a.

val set : t -> int -> elt -> unit

set a i v sets the ith zero-based element of a to v.

  • raises Invalid_argument

    if immutable is true.

val length : t -> int

length a is the length of a.

val init : int -> (int -> elt) -> t

init n f is an array of length n with get v i = f i.

val iter : (elt -> unit) -> t -> unit

iter iterates over all elements of the array in increasing index order.

val fold_left : ('a -> elt -> 'a) -> 'a -> t -> 'a

fold_left f init a folds f over a's elements in increasing index order starting with init.

val equal : (elt -> elt -> bool) -> t -> t -> bool

equal eq a0 a1 is true if and only if tests a0 and a1 have the same length n for all i in [0];[n-1], eq (get a0 i) (get a1 i) is true.

val compare : (elt -> elt -> int) -> t -> t -> int

compare cmp a0 a1 compare a0 and a1 according to shortlex order, that is, short arrays are smaller and equal-sized arrays are compared in lexicographic order using cmp to compare elements.

val pp_applied_name : Stdlib.Format.formatter -> unit -> unit

pp_applied_name ppf () formats an applied name for the array type.