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
.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).
A vector or list to reduce. (Not a promise.)
A function that takes two parameters. The first parameter will be
the "result" (initially
Other arguments to pass to
The initial result value of the fold, passed into
A promise that will resolve to the result of calling
.f on the last
.x had no elements). If any invocation of
results in an error or a rejected promise, then the overall
promise_reduce promise will immediately reject with that error.
1 2 3 4 5 6 7
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.