package containers

  1. Overview
  2. Docs
A modular, clean and powerful extension of the OCaml standard library

Install

Dune Dependency

Authors

Maintainers

Sources

containers-3.15.tbz
sha256=92143ceb4785ae5f8a07f3ab4ab9f6f32d31ead0536e9be4fdb818dd3c677e58
sha512=5fa80189d0e177af2302b48e72b70299d51fc36ac2019e1cbf389ff6a7f4705b10089405b5a719b3e4845b0d1349a47a967f865dc2e4e3f0d5a0167ef6c31431

doc/containers.pvec/Containers_pvec/index.html

Module Containers_pvecSource

Functional Vectors.

These are trees with a large branching factor for logarithmic operations with a low multiplicative factor.

status: experimental

  • since 3.13.1
Sourcetype 'a iter = ('a -> unit) -> unit
Sourcetype !'a t
Sourceval empty : 'a t

Empty vector.

Sourceval is_empty : _ t -> bool

Is the vector empty?

Sourceval return : 'a -> 'a t

Single element vector.

Sourceval length : _ t -> int

Number of elements. Constant time.

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

make n x makes a vector with n copies of the element x

Sourceval push : 'a t -> 'a -> 'a t

Add element at the end.

Sourceval get : 'a t -> int -> 'a
Sourceval get_opt : 'a t -> int -> 'a option
Sourceval last : 'a t -> 'a

Last element.

Sourceval last_opt : 'a t -> 'a option
Sourceval pop : 'a t -> 'a * 'a t

Pop last element.

Sourceval pop_opt : 'a t -> ('a * 'a t) option

Pop last element.

Sourceval drop_last : 'a t -> 'a t

Like pop_opt but doesn't return the last element. Returns the same vector if it's empty.

Sourceval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
Sourceval iter : ('a -> unit) -> 'a t -> unit
Sourceval iter_rev : ('a -> unit) -> 'a t -> unit

Iterate on elements but starting from the end.

Sourceval iteri : (int -> 'a -> unit) -> 'a t -> unit

Iterate on elements with their index, in increasing order.

Sourceval iteri_rev : (int -> 'a -> unit) -> 'a t -> unit

Iterate on elements with their index, but starting from the end.

Sourceval fold_left : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
Sourceval fold_rev : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
Sourceval fold_lefti : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b
Sourceval fold_revi : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b
Sourceval append : 'a t -> 'a t -> 'a t

append a b adds all elements of b at the end of a. This is at least linear in the length of b.

Sourceval map : ('a -> 'b) -> 'a t -> 'b t
Sourceval choose : 'a t -> 'a option

Return an element. It is unspecified which one is returned.

Sourceval to_list : 'a t -> 'a list
Sourceval of_list : 'a list -> 'a t
Sourceval add_list : 'a t -> 'a list -> 'a t
Sourceval add_iter : 'a t -> 'a iter -> 'a t
Sourceval of_iter : 'a iter -> 'a t
Sourceval to_iter : 'a t -> 'a iter
Sourceval add_seq : 'a t -> 'a Seq.t -> 'a t
Sourceval of_seq : 'a Seq.t -> 'a t
Sourceval to_seq : 'a t -> 'a Seq.t
OCaml

Innovation. Community. Security.