Displaying 1 result from an estimated 1 matches for "012094d8".
2005 Mar 08
2
Bug in handling of promises?
...te H to get ', H(1), '\n')
+ return(environment(NULL))
+ }
I thought that evaluating H would force it, so that H would be
available in the environment returned by the function. But this is
not so:
> env <- f( function(x) x^2 )
Evaluate H to get 1
> env$H
<promise: 012094D8>
> env$H(1)
Error: attempt to apply non-function
So I tried to explicitly force it:
> g <- function( H, prevEnv = NULL) {
+ if (!is.null(prevEnv)) H <- prevEnv$H
+ force(H)
+ return(environment(NULL))
+ }
but this still doesn't work:
> env <- g( function(...