Re: [R] list of closures

2010-08-26 Thread Stephen T.
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

Re: [R] list of closures

2010-08-26 Thread Stephen T.
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:

Re: [R] list of closures

2010-08-25 Thread Philippe Grosjean
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

Re: [R] list of closures

2010-08-25 Thread Gabor Grothendieck
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)

[R] list of closures

2010-08-25 Thread Stephen T.
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