module Simple:sig
..end
type ('a, 'b)
enum = {
|
start : |
|
step : |
'a
is the type of the enumeration state,
while 'b
is the type of the enumeration elements.
start
should return a new state pointing to the start of the enumeration.
step
should map a state to a (current element, next state) couple,
returning None
if there is no more element to return.
val enum_of_interval : int -> int -> (int, int) enum
enum_of_interval inf sup
returns an enumeration that will iterate
the interval from int
to sup
.val enum_of_list : 'a list -> ('a list, 'a) enum
enum_of_list l
returns an enumeration that will iterate over the
elements of l
.type ('a, 'b, 'c)
t = {
|
register : |
|
wait : |
Given a pool p
, returned by create e comb y0
:
p.register f
is used by agents to indicate that they can perform
computations f
, mapping xi
values to yi
results.p.wait ()
returns the combined result comb y1 (comb y2 (... (comb yn y0)))
,
where the yi
values are
the results of the xi
applied to the functions
registered by the agents. The xi
are the values returned by
the enumumeration specified at pool creation time.val create : ('d, 'a) enum ->
('b -> 'c -> 'c) -> 'c -> ('a, 'b, 'c) t
create e comb y0
returns a pool for computations of type 'a -> 'b
,
comb
being used to combine results with initial result y0
.
The enumeration e
is used to generate the input values for the
various computations.