async (version 0.0.0.9004)

async_map: Apply an asynchronous function to each element of a vector

Description

Apply an asynchronous function to each element of a vector

Usage

async_map(.x, .f, ..., .args = list(), .limit = Inf)

Arguments

.x

A list or atomic vector.

.f

Asynchronous function to apply.

...

Additional arguments to .f.

.args

More additional arguments to .f.

.limit

Number of elements to process simulateneously.

Value

Deferred value that is resolved after all deferred values from the application of .f are resolved.

See Also

Other async iterators: async_detect, async_every, async_filter

Examples

Run this code
# NOT RUN {
synchronise(async_map(
  seq(10, 100, by = 10) / 100,
  function(wait) delay(wait)$then(function() "OK")
))
# }

Run the code above in your browser using DataCamp Workspace