Easy cooperative, concurrent, and parallel computation.
(flow-time) → positive-integer? positive-integer?
Rationale: it can help to benchmark at runtime the execution of flows, and scale accordingly the number of flows.
Returns two numbers, the first represents seconds, the second nanoseconds. The whole represent an absolute time.
Note: it might just be a shortcut for jiffies.
(flow-spawn [priority] thunk) positive-integer? procedure?
Starts a new flow of execution with
THUNK raise an
object the behavior is unspecified. When
THUNK returns, returned
values, if any, are unreachable.
PRIORITY is a hint to help the host choose what flow to execute.
The default value of
PRIORITY is zero. A priority of
THUNK should have exclusive / dedicated access to one
Returns a channel.
Returns true, if
OBJ is a channel, otherwise false. A channel allows
communication between flows.
Returns true, if
OBJ is an operation, otherwise false.
(flow-wrap operation proc)
Wrap an operation with
OPERATION is applied by
flow-apply returned values called
objs, will be applied to
(flow-produce channel objs ...)
Returns an operation, that will produce
flow-apply, and will return no values.
A flow that is producing values on a channel, may wait indefinitly if there is nobody consuming on the same channel.
flow-produce will apply once and only once with one and only one
Returns an operation, that will consume and return objects produced on
CHANNEL when applied by
A flow may wait indefinitly if there is nobody producing on the same channel.
flow-consume will apply once and only once with one and only
(flow-sleep seconds [nanoseconds])
Returns an operation. When applied by
flow-apply returns after
NANOSECONDS In other words the following code will
return after one second, the value
(flow-apply (flow-wrap (flow-sleep 1) (lambda () 'done-sleeping)))
It can be used with
flow-choice to implement timeouts, and avoid the
situations where flows wait indefinitly.
Returns an operation made of all
OPERATIONS. When applied, it will
return the return values, of one and only one operation.
Apply an operation. The flow that called
flow-apply does not
necessarly return immediatly.
??? explanation of how it meets the sample implementation requirement (see process), and the code, if possible, or a link to it Source for the sample implementation.
??? Give credits where credits is due.