Method Concurrent.Promise()->fold()
- Method fold
this_programfold(mixedinitial,function(mixed,mixed,mixed... :mixed)fun,mixed...extra)- 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 argument is the current value of the accumulator.- Parameter
extra Any extra context needed for
fun. They will be provided as arguments three and onwards whenfunis called.- Returns
The new Promise.
- Note
If
funthrows an error it will fail the Future.- Note
funmay be called in any order, and will be called once for every Future it depends upon, unless one of the calls fails in which case no further calls will be performed.- See also