See if this is helpful. In essence, the argument p is transferred to the environment of the body of the Curry () function:
> body(f2)
do.call(FUN, c(.orig, list(...)))
> body(f2)[[1]]
do.call
> body(f2)[[3]]
c(.orig, list(...))
> body(f2)[[3]][[2]]
.orig
> eval(body(f2)[[3]][[2]])
Error in eval(expr, envir, enclos) : object '.orig' not found
> eval(body(f2)[[3]][[2]], environment(f2) )
$p
[1] 2
They can be used as BrodieG comments when programming an attack on a problem:
> environment(f2)$.orig
$p
[1] 2
> environment(f2)$.orig$p
[1] 2
To understand why I didn’t stumble upon this, first compare:
> ls( envir=environment(f2) )
[1] "FUN"
> ls( envir=environment(f2) ,all.names=TRUE)
[1] "..." ".orig" "FUN"
The function lsdisplays only elements whose initial characters are not “dots” if the parameter is all.namesnot set to TRUE.
Thus, this is also indicative:
> environment(f2) $FUN
function(x, p) { x^p }
source
share