signature ARRAY structure Array : ARRAY
An extended version of the Standard ML Basis' Array structure.
See also: Array2, ArraySlice, MONO_ARRAY, Vector
Imported implicitly.
signature ARRAY = sig eqtype 'a array type 'a vector type 'a t = 'a array val maxLen : int val array : int * 'a -> 'a array val vector : 'a array -> 'a vector val fromList : 'a list -> 'a array val toList : 'a array -> 'a list val fromVector : 'a vector -> 'a array val toVector : 'a array -> 'a vector val tabulate : int * (int -> 'a) -> 'a array val length : 'a array -> int val sub : 'a array * int -> 'a val update : 'a array * int * 'a -> unit val swap : 'a array * int * int -> unit val rev : 'a array -> unit val copy : {src : 'a array, dst : 'a array, di : int} -> unit val copyVec : {src : 'a vector, dst : 'a array, di : int} -> unit val app : ('a -> unit) -> 'a array -> unit val appr : ('a -> unit) -> 'a array -> unit val modify : ('a -> 'a) -> 'a array -> unit val foldl : ('a * 'b -> 'b) -> 'b -> 'a array -> 'b val foldr : ('a * 'b -> 'b) -> 'b -> 'a array -> 'b val all : ('a -> bool) -> 'a array -> bool val exists : ('a -> bool) -> 'a array -> bool val find : ('a -> bool) -> 'a array -> 'a option val appi : (int * 'a -> unit) -> 'a array -> unit val appri : (int * 'a -> unit) -> 'a array -> unit val modifyi : (int * 'a -> 'a) -> 'a array -> unit val foldli : (int * 'a * 'b -> 'b) -> 'b -> 'a array -> 'b val foldri : (int * 'a * 'b -> 'b) -> 'b -> 'a array -> 'b val alli : (int * 'a -> bool) -> 'a array -> bool val existsi : (int * 'a -> bool) -> 'a array -> bool val findi : (int * 'a -> bool) -> 'a array -> (int * 'a) option val contains : ''a array -> ''a -> bool val notContains : ''a array -> ''a -> bool val equal : ('a * 'a -> bool) -> 'a array * 'a array -> bool val collate : ('a * 'a -> order) -> 'a array * 'a array -> order val isSorted : ('a * 'a -> order) -> 'a array -> bool val sort : ('a * 'a -> order) -> 'a array -> unit end
Items not described here are as in the Standard ML Basis' Array structure.
A local synonym for type array.
Creates a vector containing the same elements as the array arr. If v contains more than maxLen elements, then the Size exception is raised.
Creates a vector containing the same elements as the array arr. If arr contains more than Vector.maxLen elements, then the Size exception is raised. Equivalent to vector arr.
Creates a list of the elements of arr in order of increasing indices.
Reverses in-place the order of elements in array arr.
Swaps the ith and jth element of array arr. If i < 0 or |arr| <= i, or j < 0 or |arr| <= j, then the Subscript exception is raised.
Like appi and app, but apply f in right to left order (i.e., decreasing indices). The expression app f arr is equivalent to:
appri (f o #2) arr
Indexed versions of the functions all and exists. The index of each element is passed to f as an additional argument. The following equivalences hold:
all f arr = alli (f o #2) arr exists f arr = existsi (f o #2) arr
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 arr a).
Creates an equality function on arrays given an equality on the element type.
Returns true iff arr is sorted with respect to the ordering function f.
Sorts arr with respect to the ordering function f. Sorting may be unstable with respect to equal elements.