module Vector:sig..end
Efficient persistent vectors based on RRB-Trees
RRB (Relaxed Radix-Balanced) Trees allows "effectively constant" operations like getting element / updating at index, appending and splitting.
type '_ t
module Builder:sig..end
Efficient construction of vectors using mutable, one-by-one appending of elements
exception Out_of_bounds of {
|
index : |
|
size : |
val empty : 'a tEmpty vector.
val cons : 'a -> 'a t -> 'a tPrepend one element to vector. "Effectively constant".
val snoc : 'a t -> 'a -> 'a tApppend one element to vector. "Effectively constant".
val length : 'a t -> intThe length of a vector.
val init : int -> (int -> 'a) -> 'a tinit l f creates vector of length l where value at position i is
initialized with f i.
val append : 'a t -> 'a t -> 'a tConcatenates two vectors. "Effectively constant".
val get : 'a t -> int -> 'aget v i returns the element of a v at position i. "Effectively
constant".
Raise Out_of_bounds when i is outside of v bounds.
val update : 'a t -> int -> 'a -> 'a tupdate v i x returns new vector initialized with values of v where
value at index i is replaced with x. "Effectively constant".
Raise Out_of_bounds when i is outside of v bounds.
val split_at : 'a t -> int -> 'a t * 'a tsplit_at v i returns pair of a vectors where first element is the prefix
of v of length i and second is the suffix of v starting at i.
"Effectively constant".
Raise Out_of_bounds when i is negative.
val take : 'a t -> int -> 'a ttake v i returns the prefix of v of length i. "Effectively
constant".
Raise Out_of_bounds when i is negative.
val drop : 'a t -> int -> 'a tdrop v i returns the suffix of v starting at i. "Effectively
constant".
Raise Out_of_bounds when i is negative.
val iter : ('a -> unit) -> 'a t -> unititer f v iterates over v applying f to each element.
val of_list : 'a list -> 'a tConverts list to vector
val to_list : 'a t -> 'a listConverts vector to list
include Monad.S
include Foldable.S
include Align.S
module A:
module A2:functor (A:Applicative.Basic2) ->Traversable.S2with type 'a t := 'a t and type ('u, 'a) f := ('u, 'a) A.t
module A3:functor (A:Applicative.Basic3) ->Traversable.S3with type 'a t := 'a t and type ('u, 'v, 'a) f := ('u, 'v, 'a) A.t
module M:
module M2:
module M3: