Re: [R] unexpected scoping behavior with functions created in a loop

2008-12-06 Thread Antonio, Fabio Di Narzo
2008/12/6 Gabor Grothendieck <[EMAIL PROTECTED]>: > The missing item is lazy evaluation. Try forcing the evaluation of i > and then repeat: > > makeF <- function(i) { force(i); function() i } Tnx! That works! Sometimes lazy evaluation + side effects is just too much (complicated) for me:D bests,

Re: [R] unexpected scoping behavior with functions created in a loop

2008-12-06 Thread Gabor Grothendieck
The missing item is lazy evaluation. Try forcing the evaluation of i and then repeat: makeF <- function(i) { force(i); function() i } On Sat, Dec 6, 2008 at 9:22 PM, Antonio, Fabio Di Narzo <[EMAIL PROTECTED]> wrote: > Hi guys. > I recently stumbled on an unexpected behavior of R when using > f

[R] unexpected scoping behavior with functions created in a loop

2008-12-06 Thread Antonio, Fabio Di Narzo
Hi guys. I recently stumbled on an unexpected behavior of R when using functions created in a loop. The problem is silly enough to me that I had hard time choosing a good mail subject, not talking about searching in the archives... After some experiments, I trimmed down the following minimal reprod