On Sun, Mar 20, 2011 at 12:10 AM, Russ Abbott <russ.abb...@gmail.com> wrote:
> Actually I'm a big Haskell fan. So I think of functional programming very
> positively.  However, the environment() function doesn't seem to be treated
> functionally.  If I write
>    this <- environment()
> at the top of the previous example, the other functions and the variables
> they are bound to are inserted into the environment which had already been
> bound to 'this' afterwards.
>
> In fact, even when it is left at the end that line inserts 'this' into the
> environment, which strictly speaking it shouldn't do. So there seem to be
> some not-quite-functional processes going on.
>

this <- environment() does not create an environment.  It merely
allows this to refer to the environment that was already there and is
what holds the variables created during the execution of the function.


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
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