async (version 0.0.0.9004)

async_constant: Make a minimal deferred that resolves to the specified value

Description

This is sometimes useful to start a deferred chain.

Usage

async_constant(value = NULL)

Arguments

value

The value to resolve to.

Value

A deferred value.

Details

Note that the evaluation of value is forced when the deferred value is created.

Examples

Run this code
# NOT RUN {
afun <- async(function() {
  async_constant(1/100)$
    then(function(x) delay(x))$
    then(function(x) print(x))
})
synchronise(afun())
# }

Run the code above in your browser using DataCamp Workspace