Module Prime_accretion_map

Accumulation of a monoid over a map (prime.unstable).

Given a monoid operation, say ∗, these map-like structures maintains the of nested application of the operator over the elements of the map in key-order. E.g. given 5 elements inserted with keys such that the order is a, ..., e, then the accumulated result may be computed as (ab) ∗ (c ∗ (de)) or any other associative combination, yielding the same result. The map is represented as a balanced tree, storing intermediate results, so adding or removing elements is amortized O(log n).

There are four functors depending on parametricity of the element type and whether or not the generator type is explicit.

include module type of Prime_accretion_map_intf
module type Monoid1 = sig ... end

A monoid on a polymorphic type.

module type Monoid = sig ... end

A monoid structure.

module type MonoidG1 = sig ... end

A monoid on a polymorphic type with an explicit generator type.

module type MonoidG = sig ... end

A monoid with an explicit generator type.

module type S1 = sig ... end

Signature for an accretion map with polymorphic elements.

module type S = sig ... end

Signature for an accretion map with monomorphic elements. See S1 for documentation.

module Make1 : functor (Key : Stdlib.Map.OrderedType) -> functor (Elt : Monoid1) -> S1 with type key = Key.t and type 'a elt = 'a Elt.t and type 'a result = 'a Elt.t

Accretion map of a polymorphic monoid type.

module Make : functor (Key : Stdlib.Map.OrderedType) -> functor (Elt : Monoid) -> S with type key = Key.t and type elt = Elt.t and type result = Elt.t

Accretion map of a monomorphic monoid type.

module MakeG1 : functor (Key : Stdlib.Map.OrderedType) -> functor (Elt : MonoidG1) -> S1 with type key = Key.t and type 'a elt = 'a Elt.generator and type 'a result = 'a Elt.t

Accretion map of a polymorphic monoid type with an explicit generator.

module MakeG : functor (Key : Stdlib.Map.OrderedType) -> functor (Elt : MonoidG) -> S with type key = Key.t and type elt = Elt.generator and type result = Elt.t

Accretion map of a monomorphic monoid type with an explicit generator.