Rev 68948 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/forceAndCall.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2015 R Core Team% Distributed under GPL 2 or later\name{forceAndCall}\alias{forceAndCall}\title{Call a function with Some Arguments Forced}\description{Call a function with a specified number of leading arguments forcedbefore the call if the function is a closure.}\usage{forceAndCall(n, FUN, ...)}\arguments{\item{n}{number of leading arguments to force.}\item{FUN}{function to call.}\item{\dots}{arguments to \code{FUN}.}}\details{\code{forceAndCall} calls the function \code{FUN} with argumentsspecified in \code{\dots}. If the value of \code{FUN} is a closurethen the first \code{n} arguments to the function are evaluated(i.e. their delayed evaluation promises are forced) before executingthe function body. If the value of \code{FUN} is a primitive thenthe call \code{FUN(\dots)} is evaluated in the usual way.\code{forceAndCall} is intended to help defining higher orderfunctions like \code{\link{apply}} to behave more reasonably when theresult returned by the function applied is a closure that captured itsarguments.}\seealso{\code{\link{force}}, \code{\link{promise}}, \code{\link{closure}}.}\keyword{programming}