signature ARRAY2 structure Array2 : ARRAY2
An extended version of the Standard ML Basis' Array2 structure.
See also: Array
Imported implicitly.
signature ARRAY2 = sig type 'a array type 'a t = 'a array type 'a region = { base : 'a array, row : int, col : int, nrows : int option, ncols : int option } datatype traversal = RowMajor | ColMajor val array : int * int * 'a -> 'a array val fromList : 'a list list -> 'a array val toList : 'a array -> 'a list list val tabulate : traversal -> int * int * (int * int -> 'a) -> 'a array val sub : 'a array * int * int -> 'a val update : 'a array * int * int * 'a -> unit val dimensions : 'a array -> int * int val nRows : 'a array -> int val nCols : 'a array -> int val row : 'a array * int -> 'a vector val column : 'a array * int -> 'a vector val copy : {src : 'a region, dst : 'a array, dst_row : int, dst_col : int } -> unit val app : traversal -> ('a -> unit) -> 'a array -> unit val modify : traversal -> ('a -> 'a) -> 'a array -> unit val fold : traversal -> ('a * 'b -> 'b) -> 'b -> 'a array -> 'b val all : traversal -> ('a -> bool) -> 'a array -> bool val exists : traversal -> ('a -> bool) -> 'a array -> bool val appi : traversal -> (int * int * 'a -> unit) -> 'a region -> unit val modifyi : traversal -> (int * int * 'a -> 'a) -> 'a region -> unit val foldi : traversal -> (int * int * 'a * 'b -> 'b) -> 'b -> 'a region -> 'b val alli : traversal -> (int * int * 'a -> bool) -> 'a region -> bool val existsi : traversal -> (int * int * 'a -> bool) -> 'a region -> bool val contains : traversal -> ''a array -> ''a -> bool val notContains : traversal -> ''a array -> ''a -> bool val equal : traversal -> ('a * 'a -> bool) -> 'a array * 'a array -> bool end
Items not described here are as in the Standard ML Basis' Array2 structure.
A local synonym for type array.
Creates a list of a list of the elements of arr in row major form. That is, given a valid list l the following equation holds:
toList (fromList l) = l
These functions apply f to each element of arr in the order specified by trv. The function all returns false as soon as f x returns false; true if no such x exists. The function exists returns true as soon as f x returns true; false if no such x exists.
Indexed versions of the functions all and exists, that operate on the given region of an array. The coordinates of each element are passed to f as additional arguments. The following equivalences hold:
all f arr = alli (f o #3) {base = arr, row = 0, col = 0, nrows = NONE, ncols = NONE} exists f arr = existsi (f o #3) {base = arr, row = 0, col = 0, nrows = NONE, ncols = NONE}
Returns true if the element a occurs in the array arr; otherwise false.
Returns true if the element a does not occur in the array arr; otherwise false. Equivalent to not(contains trv arr a).
Creates an equality function on arrays given a traversal mode and an equality on the element type.