[plt-scheme] Scheme and R

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Thu Mar 26 18:28:34 EDT 2009

Neil Toronto wrote:

> Back to lexical scope. To get around = creating bindings and how that 
> makes it difficult to mutate outer scope variables, R has a special 
> assignment operator <<- that operates on the nearest outer scope. It 
> also creates bindings there if they don't already exist. It's like 
> Python's "global" but for any level. Funky.

There's something weird going on with scope in "lazy evaluation" in R. 
It's not lexical, but dynamic, and it's not clear to me when it flips 
from one to the other.

It's fairly clear to me that the students in the stats course I'm 
talking about will not be dealing with most of these issues -- I think 
they're just asked to apply library functions without really 
understanding what they're doing. So the risk here is that in 
highlighting the similarities to Scheme -- and the differences from 
Scheme, which inevitably follow -- I would actually be doing them a 
disservice, relative to their prior blissfully ignorant state. --PR

Posted on the users mailing list.