Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

Re: [R] Evaluation of defaults in functions

hadley wickham

2006-09-29

Replies:

> > But doesn't R has a rather limited force of lazy evaluation? - you
> > have no control over it, apart from that arguments are evaluated
> > lazily. This rather limited compared to other languages (no lazy
> > lists etc)
>
> You do have more control than that. You can't put a promise in a list,
> but you can put one in an environment, e.g.
>
> > x <- new.env()
> > y <- 1
> > delayedAssign("z", y, assign=x)
> > y <- 2
> > x$z
> [1] 2

That's interesting. Is it possible to treat an environment like a
list in most situations?

I had experimented with lazy lists/streams in R a while go (as they
seem like a very natural way of dealing with datasets that are too
large to fit in memory) but got stuck. This might let me get a little
further.

Hadley

______________________________________________
R-help@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.