package containers
Install
Dune Dependency
Authors
Maintainers
Sources
md5=03b80e963186e91ddac62ef645bf7fb2
sha512=c8f434808be540c16926bf03d89f394d33fc2d092f963a7b6d412481229e0a96290f1ad7c7d522415115d35426b7aa0b3fda4b991ddc321dad279d402c9a0c0b
doc/containers.data/CCPersistentArray/index.html
Module CCPersistentArray
Source
Persistent Arrays
From the paper by Jean-Christophe Filliâtre, "A persistent Union-Find data structure", see the ps version
The type of persistent arrays
make n x
returns a persistent array of length n, with x
. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.
init n f
returns a persistent array of length n, with element i
initialized to the result of f i
.
Apply the given function to all elements of the array, and return a persistent array initialized by the results of f. In the case of mapi
, the function is also given the index of the element. It is equivalent to fun f t -> init (fun i -> f (get t i))
.
iter f t
applies function f
to all elements of the persistent array, in order from element 0
to element length t - 1
.
iter f t
applies function f
to all elements of the persistent array, in order from element 0
to element length t - 1
.
of_list l
returns a fresh persistent array containing the elements of l
.
of_rev_list l
is the same as of_list (List.rev l)
but more efficient.