Promise-class {rsolr}R Documentation

Promises

Description

The Promise class formally and abstractly represents the potential result of a deferred computation.

Details

Lazy programming is useful in a number of contexts, including interaction with external/remote systems like databases, where we want the computation to occur within the external system, despite appearances to the contrary. Typically, the user constructs one or more promises referring to pre-existing objects. Operations on those objects produce new promises that encode the additional computations. Eventually, usually after some sort of restriction and/or aggregation, the promise is “fulfilled” to yield a materialized, eager object, such as an R vector.

Promise and its partial implementation SimplePromise provide a foundation for implementations that mostly helps with creating and fulfilling promises, while the implementation is responsible for deferring particular computations, which is language-dependent.

Construction

Fulfillment

The basic coercion functions in R, like as.vector and as.data.frame, have methods for Promise that simply call fulfill on the promise, and then perform the coercion. Coercion is preferred to calling fulfill directly.

Author(s)

Michael Lawrence


[Package rsolr version 0.0.13 Index]