ail.com
> CC: ggrothendi...@gmail.com; r-help@r-project.org
> Subject: Re: [R] list of closures
>
> Unless for learning R, you should really consider R.oo or proto packages
> that may be more convenient for you (but you don't provide enough
> context to tell).
> Best,
>
> P
dder <- function(x) function(y) x + y> plus <- Map(function(x) {force(x);
> adder(x)},c(one=1,two=2))> plus$one(1)[1] 2> plus$two(1)[1] 3
Thanks Gabor!
> From: ggrothendi...@gmail.com
> Date: Thu, 26 Aug 2010 00:28:34 -0400
> Subject: Re: [R] list of closures
> To:
Unless for learning R, you should really consider R.oo or proto packages
that may be more convenient for you (but you don't provide enough
context to tell).
Best,
Philippe
On 26/08/10 06:28, Gabor Grothendieck wrote:
On Thu, Aug 26, 2010 at 12:04 AM, Stephen T. wrote:
Hi, I wanted to creat
On Thu, Aug 26, 2010 at 12:04 AM, Stephen T. wrote:
>
> Hi, I wanted to create a list of closures. When I use Map(), mapply(),
> lapply(), etc., to create this list, it appears that the wrong arguments are
> being passed to the main function. For example:
> Main function:
>> adder <- function(x)
Hi, I wanted to create a list of closures. When I use Map(), mapply(),
lapply(), etc., to create this list, it appears that the wrong arguments are
being passed to the main function. For example:
Main function:
> adder <- function(x) function(y) x + y
Creating list of closures with Map():
> plus
5 matches
Mail list logo