## rw-vector.api
#
# General-purpose vanilla mutable vectors.
#
# See also:
#
#
src/lib/std/src/vector.api#
src/lib/std/src/typelocked-rw-vector.api#
src/lib/std/src/rw-vector-slice.api#
src/lib/std/src/typelocked-vector-slice.api#
src/lib/std/src/typelocked-rw-vector-slice.api#
src/lib/src/expanding-rw-vector.api#
src/lib/src/typelocked-expanding-rw-vector.api#
src/lib/src/hashtable.api#
src/lib/std/src/list.api#
src/lib/std/src/rw-matrix.api#
src/lib/std/src/typelocked-matrix.api#
src/lib/src/map.api# Compiled by:
#
src/lib/std/src/standard-core.sublib# This api is implemented in:
#
#
src/lib/std/src/rw-vector.pkg#
api Rw_Vector {
#
Rw_Vector(X); # Type of a fixed-length mutable vector containing elements of type X.
Vector(X); # Type of a fixed-length immutable vector containing elements of type X.
maximum_vector_length: Int; # Absolute maximum number of elements in a vector. (A couple of billion on 32-bit machines.)
make_rw_vector: (Int, X) -> Rw_Vector(X); # Create rw_vector of given length with all slots initialized to given value.
from_list: List(X) -> Rw_Vector(X); # Create rw_vector of same length and contents as given list.
from_fn: (Int, (Int -> X)) -> Rw_Vector(X); # Create rw_vector of given length, calling given fn (with slot number) to generate initial value for eachs lot.
length: Rw_Vector(X) -> Int; # Return length of rw_vector. This will be one greater than last valid index into rw_vector.
get: (Rw_Vector(X), Int) -> X; # Get i-th slot from rw_vector. Raise exception INDEX_OUT_OF_BOUNDS on invalid index.
(_[]): (Rw_Vector(X), Int) -> X; # Synonym for previous; supports foo = vector[i]; syntax.
set: (Rw_Vector(X), Int, X) -> Void; # Set i-th slot in rw_vector to given value. Raise exception INDEX_OUT_OF_BOUNDS on invalid index.
(_[]:=): (Rw_Vector(X), Int, X) -> Void; # Synonym for previous; supports vector[i] := foo; syntax.
to_vector: Rw_Vector(X) -> Vector(X); # Convert a mutable vector into an immutable vector.
copy: { from: Rw_Vector(X), into: Rw_Vector(X), at: Int } -> Void; # Copy complete contents of 'from' rw_vector into 'into' rw_vector starting at offset 'at'. Raise exception INDEX_OUT_OF_BOUNDS on invalid index.
copy_vector: { from: Vector(X), into: Rw_Vector(X), at: Int } -> Void; # Copy complete contents of 'from' vector into 'into' rw_vector starting at offset 'at'. Raise exception INDEX_OUT_OF_BOUNDS on invalid index.
apply: (X -> Void) -> Rw_Vector(X) -> Void; # Apply given fn to every element of given rw_vector.
keyed_apply: ((Int, X) -> Void) -> Rw_Vector(X) -> Void; # Apply given fn to every element of given rw_vector, also supplying slot number to fn.
map_in_place: (X -> X) -> Rw_Vector(X) -> Void; # Replace every element of given rw_vector with result of applying given fn to it.
keyed_map_in_place: ((Int, X) -> X) -> Rw_Vector(X) -> Void; # Replace every element of given rw_vector with result of applying given fn to it, also supplying slot number to given fn.
fold_forward: ((X, Y) -> Y) -> Y -> Rw_Vector(X) -> Y; # Sum (or whatever) the elements of given rw_vector starting at left. The given fn supplies the reduction operation to perform.
fold_backward: ((X, Y) -> Y) -> Y -> Rw_Vector(X) -> Y; # Sum (or whatever) the elements of given rw_vector starting at right. The given fn supplies the reduction operation to perform.
keyed_fold_forward: ((Int, X, Y) -> Y) -> Y -> Rw_Vector(X) -> Y; # Same as fold_forward, except supplied fn is also given the slot number.
keyed_fold_backward: ((Int, X, Y) -> Y) -> Y -> Rw_Vector(X) -> Y; # Same as fold_backward, except supplied fn is also given the slot number.
find: (X -> Bool) -> Rw_Vector(X) -> Null_Or(X); # Find and return first element satisfying given predicate, else NULL.
keyed_find: ((Int, X) -> Bool) -> Rw_Vector(X) -> Null_Or ((Int, X)); # Same, but predicate fn is also given slot number, and slot number is returned.
exists: (X -> Bool) -> Rw_Vector(X) -> Bool; # Return TRUE iff the given fn returns TRUE for at least one element of the vector.
all: (X -> Bool) -> Rw_Vector(X) -> Bool; # Return TRUE iff the given fn returns TRUE for all elements of the vector.
compare_sequences: ((X, X) -> Order) -> (Rw_Vector(X), Rw_Vector(X)) -> Order; # Compare two rw_vectors for order using given fn to compare matching elements. If all corresponding elements match, use length as tiebreaker.
};
## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.