Method Concurrent.fold()
- Method fold
Future
fold(array
(Future
)futures
,mixed
initial
,function
(mixed
,mixed
,mixed
... :mixed
)fun
,mixed
...extra
)- Description
Return a Future that represents the accumulated results of applying
fun
to the results of thefutures
in turn.- Parameter
initial
Initial value of the accumulator.
- Parameter
fun
Function to apply. The first argument is the result of one of the
futures
, the second the current accumulated value, and any further fromextra
.- Note
If
fun
throws an error it will fail the Future.- Note
fun
may be called in any order, and will be called once for every Future infutures
, unless one of calls fails in which case no further calls will be performed.