Re: [R] lazy evaluation question

2009-01-19 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: > Notice also that in > > lapply(1:4,function(i) F(i)) > > it would be pretty weird if lapply would behave differently depending > on the name of formal arguments of the function, i.e. if > > lapply(1:4,function(meep) F(meep)) > > gave a different result. And f() depends on

Re: [R] lazy evaluation question

2009-01-19 Thread Gabor Grothendieck
On Mon, Jan 19, 2009 at 12:40 PM, Peter Dalgaard wrote: > Gabor Grothendieck wrote: >> >> Note that >> >> rm(i) >> for(j in 1:4) F(j) >> >> raises an error due to scoping issues. > > Yes. This has nothing to do with lazy evaluation, and everything to do with > scoping: f is not defined in the scop

Re: [R] lazy evaluation question

2009-01-19 Thread Peter Dalgaard
Gabor Grothendieck wrote: Note that rm(i) for(j in 1:4) F(j) raises an error due to scoping issues. Yes. This has nothing to do with lazy evaluation, and everything to do with scoping: f is not defined in the scope of F, so does not know about its variables (nor those in the implicit loop o

Re: [R] lazy evaluation question

2009-01-18 Thread Gabor Grothendieck
Note that rm(i) for(j in 1:4) F(j) raises an error due to scoping issues. On Sun, Jan 18, 2009 at 10:02 PM, wrote: > I've been going back to old difficult R-list "evaluation" emails that I save > in order to understand evaluation better and below still confuses me. Could > someone explain why

[R] lazy evaluation question

2009-01-18 Thread markleeds
I've been going back to old difficult R-list "evaluation" emails that I save in order to understand evaluation better and below still confuses me. Could someone explain why A) works and B) doesn't. A variant of below is in the Pat's Inferno book also but I'm still not clear on what is happeni