Call a function with Some Arguments Forced (original) (raw)
forceAndCall {base} | R Documentation |
---|
Description
Call a function with a specified number of leading arguments forced before the call if the function is a closure.
Usage
forceAndCall(n, FUN, ...)
Arguments
n | number of leading arguments to force. |
---|---|
FUN | function to call. |
... | arguments to FUN. |
Details
forceAndCall
calls the function FUN
with arguments specified in ...
. If the value of FUN
is a closure then the first n
arguments to the function are evaluated (i.e. their delayed evaluation promises are forced) before executing the function body. If the value of FUN
is a primitive then the call FUN(...)
is evaluated in the usual way.
forceAndCall
is intended to help defining higher order functions like [apply](../../base/help/apply.html)
to behave more reasonably when the result returned by the function applied is a closure that captured its arguments.
See Also
[force](../../base/help/force.html)
, [promise](../../base/help/promise.html)
, [closure](../../base/help/closure.html)
.
[Package _base_ version 4.6.0 Index]