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

View source: R/map.R

async_mapR Documentation

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

synchronise(async_map(
  seq(10, 100, by = 10) / 100,
  function(wait) delay(wait)$then(function() "OK")
))

r-lib/async documentation built on Nov. 19, 2024, 12:08 p.m.