Similar to purrr::reduce (left fold), but the function .f is permitted
to return a promise. promise_reduce will wait for any returned promise to
resolve before invoking .f with the next element; in other words, execution
is serial. .f can return a promise as output but should never encounter a
promise as input (unless .x itself is a list of promises to begin with, in
which case the second parameter would be a promise).
Arguments
- .x
A vector or list to reduce. (Not a promise.)
- .f
A function that takes two parameters. The first parameter will be the "result" (initially
.init, and then set to the result of the most recent call tofunc), and the second parameter will be an element of.x.- ...
Other arguments to pass to
.f- .init
The initial result value of the fold, passed into
.fwhen it is first executed.