I am porting a program in matlab to R,
The problem is that Matlab has a feature where symbols that aren't arguments 
are evaluated immediately.
That is:
Y=3
F=@(x) x*Y

Will yield a function such that F(2)=6.
If later say. Y=4 then F(2) will still equal 6.

R on the other hand has lazy evaluation.
F<-function(x){x*Y}
Will do the following
Y=3
F(2)=6
Y=4
F(2)=8.
Does anyone know of away to defeat lazy evaluation in R so that I can easily 
simulate the Matlab behavior.  I know that I can live without this in ordinary 
programming but it would make my port much easier.

Thanks.




The information in this e-mail is intended only for the ...{{dropped:14}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to