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 (a ∗ b) ∗ (c ∗ (d ∗ e)) 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 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.