module Collector:`sig`

..`end`

Collecting countdowns, or *collectors*.

`type ``('a, 'b)`

t = {

` ` |
`collect : ` |

` ` |
`wait : ` |

Type of collectors.

Collectors are refinements of countdowns, which collect and
combine `n`

partial results (type `'a`

) into a final result
(type `'b`

). Given a collector `c`

for `n`

events, with
combining function `comb`

and initial result `y0`

:

- The
`n`

events,`x1`

,...,`xn`

, are sent as`n`

messages on`c.collect`

. Notice that the notation`xi`

does not imply any kind of ordering. - Then
`c.wait()`

returns the value`comb x1 (comb x2 (... (comb xn y0)))`

. Again, at most one call`c.wait()`

returns.

`val create : ``('a -> 'b -> 'b) -> 'b -> int -> ('a, 'b) t`

`create comb y0 n`

returns a collector of `n`

events of type `'a`

, with combining function `comb`

and initial
result `y0`

.