From earino at gmail.com  Mon Feb 23 22:53:00 2015
From: earino at gmail.com (Eduardo Arino de la Rubia)
Date: Mon, 23 Feb 2015 21:53:00 +0000
Subject: [Rd] iterated lapply
References: <1424725069.2636.5.camel@physik.uni-freiburg.de>
	<CABFfbXsV=-ra9pZEwWexBX3SashfwBrV2HgSgHWu16hyaJcbjA@mail.gmail.com>
Message-ID: <CABuA6KCEtFQU6JQ9XWPF-BbkF9xd7gRebmM+aTMeTExPEPYEPA@mail.gmail.com>

Greetings!

I thought it was a lazy evaluation thing. I added "force" around
mycondition and everything worked as expected.

Cheers!

On Mon Feb 23 2015 at 1:47:20 PM Jeroen Ooms <jeroenooms at gmail.com> wrote:

> On Mon, Feb 23, 2015 at 12:57 PM, Daniel Kaschek
> <daniel.kaschek at physik.uni-freiburg.de> wrote:
> > Is this a bug or a feature?
>
> I think it is a bug. If we use substitute to inspect the promise, it
> appears the index number is always equal to its last value:
>
> vec <- c("foo", "bar", "baz")
> test <- lapply(vec, function(x){
>   function(){x}
> })
> substitute(x, environment(test[[1]]))
> substitute(x, environment(test[[2]]))
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



[Rd] iterated lapply
Eduardo Arino de la Rubia