chickadee » srfi-189 » either-compose

maybe-compose mproc1 mproc2 ...procedure
either-compose mproc1 mproc2 ...procedure

Returns an mproc that accepts zero or more arguments and applies the following iterative algorithm to each mproc:

The mproc is applied to the arguments and returns a Maybe/Either interim result. If the result is Nothing / a Left, it is returned as the final result. If it is a Just/Right, the next mproc is applied to the values of its payload, returning the next interim result. When no more mprocs are available, the interim result is returned as the final result.

It is an error if one of the mprocs does not accept as arguments the number of values wrapped in the Just/Right produced by its predecessor.