Module Sidekick_util.IArray
type 'a t= private 'a arrayArray 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 is_empty : _ t -> boolval length : _ t -> intval sub : 'a t -> int -> int -> 'a tval singleton : 'a -> 'a tval doubleton : 'a -> 'a -> 'a tval make : int -> 'a -> 'a tmake n xmakes an array ofntimesx
val init : int -> (int -> 'a) -> 'a tinit n fmakes the array[| f 0; f 1; ... ; f (n-1) |].- raises Invalid_argument
if
n < 0
val get : 'a t -> int -> 'aAccess the element
val unsafe_get : 'a t -> int -> 'aUnsafe access, not bound-checked. Use with caution
val map : ('a -> 'b) -> 'a t -> 'b tval mapi : (int -> 'a -> 'b) -> 'a t -> 'b tval append : 'a t -> 'a t -> 'a tval 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 -> bool
Conversions
val of_list : 'a list -> 'a tval to_list : 'a t -> 'a listval of_list_map : ('a -> 'b) -> 'a list -> 'b tval to_list_map : ('a -> 'b) -> 'a t -> 'b listval of_array_map : ('a -> 'b) -> 'a array -> 'b tval to_array_map : ('a -> 'b) -> 'a t -> 'b arrayval of_array_unsafe : 'a array -> 'a tTake ownership of the given array. Careful, the array must NOT be modified afterwards!
IO
Binary
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> boolval compare : ('a -> 'a -> int) -> 'a t -> 'a t -> intval for_all2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> boolval exists2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> boolval map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c tval fold2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'accval iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit