package containers

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Functional Vectors

Tree with a large branching factor for logarithmic operations with a low multiplicative factor.

status: experimental. DO NOT USE (yet)

  • since 2.1
type 'a sequence = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Format.formatter -> 'a -> unit
type 'a ktree = unit -> [ `Nil | `Node of 'a * 'a ktree list ]

Signature

type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val return : 'a -> 'a t
val length : _ t -> int
val push : 'a -> 'a t -> 'a t

Add element at the end.

val get : int -> 'a t -> 'a option
val get_exn : int -> 'a t -> 'a
val pop_exn : 'a t -> 'a * 'a t

Pop last element.

val pop : 'a t -> ('a * 'a t) option

Pop last element.

  • since 2.5
val iter : f:('a -> unit) -> 'a t -> unit
val iteri : f:(int -> 'a -> unit) -> 'a t -> unit

Iterate on elements with their index, in increasing order.

val iteri_rev : f:(int -> 'a -> unit) -> 'a t -> unit

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

val fold : f:('b -> 'a -> 'b) -> x:'b -> 'a t -> 'b
val foldi : f:('b -> int -> 'a -> 'b) -> x:'b -> 'a t -> 'b
val append : 'a t -> 'a t -> 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val choose : 'a t -> 'a option
Conversions
val to_list : 'a t -> 'a list
val of_list : 'a list -> 'a t
val add_list : 'a t -> 'a list -> 'a t
val add_seq : 'a t -> 'a sequence -> 'a t
val of_seq : 'a sequence -> 'a t
val to_seq : 'a t -> 'a sequence
val add_gen : 'a t -> 'a gen -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen
IO
val pp : 'a printer -> 'a t printer
OCaml

Innovation. Community. Security.