[DEPRECATED] Pipe a possibly unresolved value forward into a function. The
piped expression should be wrapped in .()
.
x %>>% f
.(expr)
a 'mirai' or mirai value at $data
that is possibly an
'unresolvedValue'.
a function that accepts 'x' as its first argument.
a piped expression.
The evaluated result, or if the mirai value of x is an 'unresolvedValue', an 'unresolvedExpr'.
An 'unresolvedExpr' encapsulates the eventual evaluation result.
Query its $data
element for resolution. Once resolved, the object
changes into a 'resolvedExpr' and the evaluated result will be available
at $data
.
Supports stringing together a series of piped expressions (as per the below example).
Wrap a piped expression in .()
to ensure that the return value is
always an 'unresolvedExpr' or 'resolvedExpr' as the case may be,
otherwise if 'x' is already resolved, the evaluated result would be
returned directly.
unresolved
may be used on an expression or its $data
element to test for resolution.
THIS PIPE IS DEPRECATED AND WILL BE REMOVED IN A FUTURE PACKAGE VERSION.
In nearly all cases, using package mirai.promises with the
promise pipe %...>%
will be more suitable, allowing side effects
to be performed upon resolution of a 'mirai'.
Usage is similar to R's native |>
pipe.
x %>>% f
is equivalent to f(x)
x %>>% f()
is equivalent to f(x)
x %>>% f(y)
is equivalent to f(x, y)
Other usage is not supported and it is not a drop-in replacement for
magrittr's %>%
pipe.
if (interactive()) {
# Only run examples in interactive R sessions
m <- mirai({Sys.sleep(0.5); 1})
b <- .(m %>>% c(2, 3) %>>% as.character)
unresolved(b)
b
b$data
call_mirai(m)
unresolved(b)
b
b$data
}