Module Prime_accretion_map.MakeG1
Accretion map of a polymorphic monoid type with an explicit generator.
Parameters
Signature
type key
= Key.t
type 'a elt
= 'a Elt.generator
type 'a result
= 'a Elt.t
type 'a t
val empty : 'a t
The empty map.
val is_empty : 'a t -> bool
is_empty m
is true iffm
is the empty map.
val cardinal : 'a t -> int
cardinal m
is the number of bindings inm
.
val result : 'a t -> 'a result
result m
is the nested application of the monoid operator over elements of the map in key-order but arbitrary associative combination.
val app : 'a t -> key -> 'a elt option
app m
is the partial function corresponding to the bindings ofm
.
val find : key -> 'a t -> 'a elt
find k m
is the element mapped tok
.- raises Not_found
if
k
has no binding inm
val add : key -> 'a elt -> 'a t -> 'a t
add k e m
is the least map bindingk
toe
and anyk' ≠ k
tofind k' m
.
val bindings : 'a t -> (key * 'a elt) list
bindings m
is the list containing(k, e)
iffk
is bound toe
inm
.
val fold : (key -> 'a elt -> 'b -> 'b) -> 'a t -> 'b -> 'b
fold f m
isf kₙ eₙ ∘ ... ∘ f k₁ e₁
where(kᵢ, eᵢ)
are the bindings ofm
in key order.
val iter : (key -> 'a elt -> unit) -> 'a t -> unit
iter f m
callsf k e
for each binding(k, e)
ofm
in key order.
val search : (key -> 'a elt -> 'b option) -> 'a t -> 'b option
search f m
isf k e
where(k, e)
is the binding with smallestk
for whichf k e ≠ None
, orNone
ifm
has no such binding.