package alba

  1. Overview
  2. Docs

A mutable vector (like a C++ vector)

type 'a t
val make_empty : unit -> 'a t

Make an empty vector

val singleton : 'a -> 'a t

A singleton vector

val make : int -> 'a -> 'a t

make n e makes a vector with size n where all elements are e.

val count : 'a t -> int

Number of elements in the vector.

val is_empty : 'a t -> bool

Is the vector empty?

val elem : 'a t -> int -> 'a

elem v i returns the ith element of the vector v.

val first : 'a t -> 'a

The first element of the vector.

val last : 'a t -> 'a

The last element of the vector.

val copy : 'a t -> 'a t

copy v returns a copy of the vector v.

val put : 'a t -> int -> 'a -> unit

put v i e sets the ith element of the vector v to e.

val push_rear : 'a t -> 'a -> unit

push_rear v e appends the element e to the end of the vector v.

val remove_n_last : 'a t -> int -> unit

remove_n_rear v n removes the last n elements of the vector v.

val remove_last : 'a t -> 'a

remove_last v removes the last element of the vector v.

val keep : 'a t -> int -> unit

keep v n keeps only the first n elements of v.

val remove : 'a t -> int -> unit

remove v i removes the ith element from the vector v.