VecA value of type ('a, 'p) Vec.t is a vector of values of type 'a, with mutability permissions 'p.
The permissions can be [`R | `W] for read-write vectors, [`R] for read-only vectors, or [`W] for write-only vectors.
val length : ('a, [> ]) t -> intReturns the length of the vector.
val capacity : ('a, [> ]) t -> intReturns the capacity of the vector.
val make : ?capacity:int -> unit -> ('a, [ `R | `W ]) tConstructs a vector with the specified capacity (defaults to 0).
val range : int -> int -> (int, [ `R | `W ]) tConstructs a vector containing all numbers in the specified range. Both ascending and descending ranges are supported.
val singleton : 'a -> ('a, [ `R | `W ]) tReturns a singleton vector containing the specified item. (Applicative functor pure operation)
Reinterprets the vector as a write-only vector.
val get : ('a, [> `R ]) t -> int -> 'aGets the value in the vector at the specified index.
val try_get : ('a, [> `R ]) t -> int -> 'a optionGets the value in the vector at the specified index. Returns None if the index is out of range.
val set : ('a, [> `W ]) t -> int -> 'a -> unitSets the value in the vector at the specified index to the specified value.
val try_set : ('a, [> `W ]) t -> int -> 'a -> boolSets the value in the vector at the specified index to the specified value. Returns false if the index is out of range.
val find : ('a -> bool) -> ('a, [> `W ]) t -> 'aReturns the first element of the vector that satisfies the predicate.
val try_find : ('a -> bool) -> ('a, [> `W ]) t -> 'a optionReturns the first element of the vector that satisfies the predicate, or None.
val of_list : 'a list -> ('a, [ `R | `W ]) tConstructs a vector from the specified list.
val to_list : ('a, [> `R ]) t -> 'a listConstructs a list from the specified vector.
val of_array : 'a array -> ('a, [ `R | `W ]) tConstructs a vector from a copy of the specified array.
val to_array : ('a, [> `R ]) t -> 'a arrayConstructs an array containing the values of specified vector.
val of_array_unsafe : 'a array -> ('a, [ `R | `W ]) tConstructs a vector from the specified array, without copying.
val to_array_unsafe : ('a, [ `R | `W ]) t -> 'a arrayReturns the vector's underlying buffer. Note: The array may contain uninitialized elements.
val pretty_print : ('a -> string) -> ('a, [> `R ]) t -> stringReturns a string representation of the vector, using the specified function to format each value.
val clear : ('a, [> `W ]) t -> unitResets the vector to an empty state.
val reserve : int -> ('a, [> `W ]) t -> unitEnsures the vector's capacity is at least as large as the specified value, allocating if necessary.
val shrink_to_fit : ('a, [> `W ]) t -> unitShrinks the vector's internal buffer to only be as large as the vector's length.
val push : 'a -> ('a, [> `W ]) t -> unitPushes the specified item onto the end of the vector.
val pop : ('a, [ `R | `W ]) t -> 'aPops off the item from the end of the vector.
val try_pop : ('a, [ `R | `W ]) t -> 'a optionPops off the item from the end of the vector. Returns None if the vector is empty.
val insert_at : int -> 'a -> ('a, [> `W ]) t -> unitInserts an item into the vector at the specified index.
val try_insert_at : int -> 'a -> ('a, [> `W ]) t -> boolInserts an item into the vector at the specified index. Returns false if the index is out of range.
val remove_at : int -> ('a, [ `R | `W ]) t -> 'aRemoves and returns the item at the specified index.
val try_remove_at : int -> ('a, [ `R | `W ]) t -> 'a optionRemoves and returns the item at the specified index. Returns None if the index is out of range.
Maps the specified function over the vector, returning a new vector. (Functor map operation)
Like map, but the function also takes the item's index as a parameter.
val map_in_place : ('a -> 'a) -> ('a, [ `R | `W ]) t -> unitLike map, but the transformation is done in-place.
Like map, but flattens the result. (Monad bind operation)
Returns a new vector that contains all the items in the specified vector, but in reverse order.
val rev_in_place : ('a, [ `R | `W ]) t -> unitReverses the vector in-place.
Returns a new vector containing only the items from the first vector that satisfy the specified predicate.
Like filter, but the predicate also takes the item's index as a parameter.
val filter_in_place : ('a -> bool) -> ('a, [ `R | `W ]) t -> unitPerforms a filter in-place, based on the specified predicate.
val fold_left : ('b -> 'a -> 'b) -> 'b -> ('a, [> `R ]) t -> 'bFolds the specified function and default value over the array, from left to right.
val fold_right : ('a -> 'b -> 'b) -> ('a, [> `R ]) t -> 'b -> 'bFolds the specified function and default value over the array, from right to left.
Concatenates the two vectors into a new vector.
Appends the second vector to the first vector in-place.
Cartesian product of 2 vectors. (Equivalent to liftA2 (,))
Maps the specified function over all combinations of tuples from the 2 vectors, returning a new vector. (Applicative functor liftA2 operation
Applies every function from the first vector to every value from the second vector, returning a new vector. (Applicatve functor ap operation)
Flattens nested vectors into a single, one-dimensional vector. (Monad join operation)
Zips the two vectors together.
Zips the two vectors together, using the specified function to combine values.
val exists : ('a -> bool) -> ('a, [> `R ]) t -> boolReturns true if any item in the vector satisfies the specified predicate.
val for_all : ('a -> bool) -> ('a, [> `R ]) t -> boolReturns true if all items in the vector satisfy the specified predicate.
val mem : 'a -> ('a, [> `R ]) t -> boolReturns true if the specified item exists in the vector. Uses structural equality.
val memq : 'a -> ('a, [> `R ]) t -> boolReturns true if the specified item exists in the vector. Uses physical equality.
val sort : ('a, [ `R | `W ]) t -> unitSorts the vector in-place.
val sort_by : ('a -> 'a -> int) -> ('a, [ `R | `W ]) t -> unitSorts the vector in-place, using the specified comparison function.
Compares two vectors for equality, using the specified equality function for elements.
Compares two vectors lexicographically, using the specified comparison function for elements.
val iter : ('a -> unit) -> ('a, [> `R ]) t -> unitApplies the specified function to each item in the vector.
val iteri : (int -> 'a -> unit) -> ('a, [> `R ]) t -> unitLike iter, but the function also takes the item's index as a parameter.
module Infix : sig ... endContains infix versions of some vector operations, as well as binding operators and extended indexing operators.