signature MONO_VECTOR
structure CharVector : MONO_VECTOR where type elem = char
structure Word8Vector : MONO_VECTOR where type elem = Word8.word
An extended version of the Standard ML Basis' MONO_VECTOR signature.
See also: MONO_VECTOR_SLICE, String, Vector, MONO_ARRAY
Imported implicitly.
signature MONO_VECTOR =
sig
eqtype vector
type t = vector
val maxLen : int
val toList : vector -> elem list
val fromList : elem list -> vector
val tabulate : int * (int -> elem) -> vector
val length : vector -> int
val sub : vector * int -> elem
val update : vector * int * elem -> vector
val concat : vector list -> vector
val rev : vector -> vector
val app : (elem -> unit) -> vector -> unit
val appr : (elem -> unit) -> vector -> unit
val map : (elem -> elem) -> vector -> vector
val foldl : (elem * 'a -> 'a) -> 'a -> vector -> 'a
val foldr : (elem * 'a -> 'a) -> 'a -> vector -> 'a
val all : (elem -> bool) -> vector -> bool
val exists : (elem -> bool) -> vector -> bool
val find : (elem -> bool) -> vector -> elem option
val appi : (int * elem -> unit) -> vector -> unit
val appri : (int * elem -> unit) -> vector -> unit
val mapi : (int * elem -> elem) -> vector -> vector
val foldli : (int * elem * 'a -> 'a) -> 'a -> vector -> 'a
val foldri : (int * elem * 'a -> 'a) -> 'a -> vector -> 'a
val alli : (int * elem -> bool) -> vector -> bool
val existsi : (int * elem -> bool) -> vector -> bool
val findi : (int * elem -> bool) -> vector -> (int * elem) option
val contains : (elem * elem -> bool) -> vector -> elem -> bool
val notContains : (elem * elem -> bool) -> vector -> elem -> bool
val equal : (elem * elem -> bool) -> vector * vector -> bool
val collate : (elem * elem -> order) -> vector * vector -> order
val isSorted : (elem * elem -> order) -> vector -> bool
val sort : (elem * elem -> order) -> vector -> vector
end
Items not described here are as in the Standard ML Basis' MONO_VECTOR signature.
Note that, unlike polymorphic vectors, monomorphic vectors are strict in their elements. I.e., all constructor functions taking individual element values (fromList, tabulate, update) will request any potential futures immediately.
A local synonym for type vector.
Creates a list of the elements of vec in order of increasing indices.
Returns a vector that contains the elements of vec in reverse order.
Like app and appi, but apply f in right to left order (i.e., decreasing indices). The expression app f vec is equivalent to:
appri (f o #2) vec
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 vec = alli (f o #2) vec
exists f vec = existsi (f o #2) vec
Returns true if the element a occurs in the vector vec, with respect to the element equality eq; otherwise false.
Returns true if the element a does not occur in the vector vec, with respect to the element equality eq; otherwise false. Equivalent to not(contains eq vec a).
Creates an equality function on vectors given an equality on the element type.
Returns true iff vec is sorted with respect to the ordering function f.
Returns a new vector that contains the same elements as vec, but sorted with respect to the ordering function f. Sorting may be unstable with respect to equal elements.