module Biocaml_accu:A datastructure (based on Hashtbl) to accumulate values.sig
..end
An Accu.t
can be seen as a generalized histogram: values
are mapped to bins, and each bin has a corresponding value
which may be its size or its contents depending on the need.
type ('a, 'b, 'c, 'd)
t
'instance
s are mapped to 'bin
s,
and the 'accu
mulated value for a 'bin
is updated with an
'increment
val create : ?n:int ->
'a -> ('b -> 'c) -> ('d -> 'a -> 'a) -> ('b, 'c, 'd, 'a) t
create ~n e f op
creates an accumulator, which maps instances to bins
with f
, uses e
as a neutral element (that is the value associated to a
bin before any value has been added to it) and updates the value of a bin
with op
. n
is an estimation of the maximum number of bins.val add : ('a, 'b, 'c, 'd) t -> 'a -> 'c -> unit
add accu x y
updates the value in accu
for
the bin of x
by an increment y
val enum : ('a, 'b, 'c, 'd) t -> ('b * 'd) Batteries.Enum.t
val get : ('a, 'b, 'c, 'd) t -> 'b -> 'd
get accu x
returns the value associated to b
in accu
.type'a
counter =('a, 'a, int, int) t
module Counter:sig
..end
val counts : ('a -> 'b) -> 'a Batteries.Enum.t -> ('b * int) Batteries.Enum.t