Re: [R] functional (?) programming in r

From: Stavros Macrakis <macrakis_at_alum.mit.edu>
Date: Mon, 17 Nov 2008 22:44:47 -0500

On Mon, Nov 17, 2008 at 7:33 PM, Wacek Kusnierczyk <Waclaw.Marcin.Kusnierczyk_at_idi.ntnu.no> wrote:
> Gabor Grothendieck wrote:
>> The R Language Definition manual that comes with R has a section on promises.

Certainly.

> on promises yes, but the question was whether the behaviour discussed
> before is obvious and intended, or unforeseen....

Exactly.

> ...what i would (r-naively) expect is that lapply for-loops over an index variable, and each promise picks from the list a value at that index....

Agreed. In fact, the man page for 'for' seems to explicitly specify that the iteration variable is not mutable: "The variable var... is read-only". However, the implementation doesn't seem to enforce this:

      for (i in 1:5) print(i<-i) # no error given for this assignment

           -s



R-help_at_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. Received on Tue 18 Nov 2008 - 03:49:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 18 Nov 2008 - 12:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive