module MoreArray:Utilities for arrays.sig..end
This module provides the necessary functions for applying data structure
comprehension to arrays.
val to_array : 'a -> 'a
This function does nothing. It is included for consistency.
val to_string : char array -> stringval to_stream : 'a array -> 'a Sdflow.flow
to_stream a returns a stream for reading from a. Note that
this conversion is lazy. In other words, if you modify a after
the conversion, the result of to_stream a may be affected.
val filter : ('a -> bool) -> 'a array -> 'a arrayval flatten : 'a array array -> 'a arrayval to_lazylist : 'a array -> 'a LList.t
to_lazylist a returns a stream for reading from a. Note that
this conversion is lazy. In other words, if you modify a after
the conversion, the result of to_lazylist a may be affected.
val range : int -> int -> int array
The range is never empty. If a <= b, the range contains a, a+1 ... b.
Otherwise, it contains a, a-1, ..., b.
val map_filter : ('a -> 'b option) -> 'a array -> 'b array
map_filter f [| a1; a2; ... ;an |] applies f to each
a1, ..., an. If f ai evaluates to None, the element
is not included in the result. Otherwise, if f ai evaluates
to Some x, element x is included in the result.
This is equivalent to
Array.of_list match f a1 with
| Some x1 -> x1 :: (match f a2 with
|Some x2 -> x2 :: (match ...
(match f an with
| Some xn -> [ xn ]
| None -> [ ]
)
| ...)
| None -> ... .
val length : 'a array -> int
val get : 'a array -> int -> 'aval set : 'a array -> int -> 'a -> unitval make : int -> 'a -> 'a arrayval create : int -> 'a -> 'a arrayval init : int -> (int -> 'a) -> 'a arrayval make_matrix : int -> int -> 'a -> 'a array arrayval create_matrix : int -> int -> 'a -> 'a array arrayval append : 'a array -> 'a array -> 'a arrayval concat : 'a array list -> 'a arrayval sub : 'a array -> int -> int -> 'a arrayval copy : 'a array -> 'a arrayval fill : 'a array -> int -> int -> 'a -> unitval blit : 'a array -> int -> 'a array -> int -> int -> unitval to_list : 'a array -> 'a listval of_list : 'a list -> 'a arrayval iter : ('a -> unit) -> 'a array -> unitval map : ('a -> 'b) -> 'a array -> 'b arrayval iteri : (int -> 'a -> unit) -> 'a array -> unitval mapi : (int -> 'a -> 'b) -> 'a array -> 'b arrayval fold_left : ('a -> 'b -> 'a) -> 'a -> 'b array -> 'aval fold_right : ('a -> 'b -> 'b) -> 'a array -> 'b -> 'bval sort : ('a -> 'a -> int) -> 'a array -> unitval stable_sort : ('a -> 'a -> int) -> 'a array -> unitval fast_sort : ('a -> 'a -> int) -> 'a array -> unitval unsafe_get : 'a array -> int -> 'aval unsafe_set : 'a array -> int -> 'a -> unit