module ROArray: Sundials_ROArray
Read-only polymorphic arrays.
type 'a
t
An immutable array.
val from_array : 'a array -> 'a t
Copy a mutable array into an immutable one.
val to_array : 'a t -> 'a array
Copy an immutable array into a mutable one.
val length : 'a t -> int
Return the length of the array.
val get : 'a t -> int -> 'a
Return the element at the given index.
val init : int -> (int -> 'a) -> 'a t
Create an immutable array of the given length and apply a function to set each element.
val append : 'a t -> 'a t -> 'a t
Create a new immutable array by joining two existing ones.
val concat : 'a t list -> 'a t
Create a new immutable array by concatenating a list of existing ones.
val sub : 'a t -> int -> int -> 'a t
Create a new immutable array from a slice of an existing one.
val copy : 'a t -> 'a t
Copy an immutable array.
val to_list : 'a t -> 'a list
Copy the elements of an immutable array into a list.
val of_list : 'a list -> 'a t
Copy the elements of a list into a new immutable array.
val iter : ('a -> unit) -> 'a t -> unit
Call a function successively on elements of an immutable array
starting at index 0
.
val iteri : (int -> 'a -> unit) -> 'a t -> unit
Call a function successively on index values and elements of an
immutable array starting at index 0
.
val map : ('a -> 'b) -> 'a t -> 'b t
Create a new immutable array by mapping a function across the elements of an existing one.
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
Create a new immutable array by mapping a function across the elements, and their indexes, of an existing one.
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
Fold a function across the elements of an immutable array from the
0
th element upward.
val fold_right : ('b -> 'a -> 'a) -> 'b t -> 'a -> 'a
Fold a function across the elements of an immutable array from the last element downward.
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
Call a function successively on paired elements from two immutable arrays
starting at index 0
.
Invalid_Argument
if the arrays are not of the same size.val iteri2 : (int -> 'a -> 'b -> unit) ->
'a t -> 'b t -> unit
Call a function successively on paired elements, and their indexes, from
two immutable arrays starting at index 0
.
Invalid_Argument
if the arrays are not of the same size.val map2 : ('a -> 'b -> 'c) ->
'a t -> 'b t -> 'c t
Create a new immutable array by mapping a function across the elements of two existing ones.
Invalid_Argument
if the arrays are not of the same size.val fold_left2 : ('a -> 'b -> 'c -> 'a) ->
'a -> 'b t -> 'c t -> 'a
Fold a function across the elements of two immutable arrays from the
0
th elements upward.
Invalid_Argument
if the arrays are not of the same size.val for_all : ('a -> bool) -> 'a t -> bool
Returns true only if a predicate is true for all elements of an immutable array.
val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool
Returns true only if a predicate is true for all paired elements of two immutable arrays.
Invalid_Argument
if the arrays are not of the same size.val exists : ('a -> bool) -> 'a t -> bool
Returns true only if a predicate is true for at least one element of an immutable array.
val mem : 'a -> 'a t -> bool
Returns true only if the immutable array contains an element that is structurally equal to the given one.
val memq : 'a -> 'a t -> bool
Returns true only if the immutable array contains an element that is (physically) identical to the given one.
val iter3 : ('a -> 'b -> 'c -> unit) ->
'a t ->
'b t -> 'c t -> unit
Call a function successively on triples from three immutable arrays
starting at index 0
.
Invalid_Argument
if the arrays are not of the same size.val iteri3 : (int -> 'a -> 'b -> 'c -> unit) ->
'a t ->
'b t -> 'c t -> unit
Call a function successively on triples, and their indexes, from three
immutable arrays starting at index 0
.
Invalid_Argument
if the arrays are not of the same size.val map3 : ('a -> 'b -> 'c -> 'd) ->
'a t ->
'b t -> 'c t -> 'd t
Create a new immutable array by mapping a function across the elements of three existing ones.
Invalid_Argument
if the arrays are not of the same size.val fold_left3 : ('a -> 'b -> 'c -> 'd -> 'a) ->
'a ->
'b t -> 'c t -> 'd t -> 'a
Fold a function across the elements of three immutable arrays from the
0
th elements upward.
Invalid_Argument
if the arrays are not of the same size.