[R] Partial Function Application
Mog
mogunus at gmail.com
Fri Aug 6 15:56:28 CEST 2010
Hi. I would like to partially apply a function to a list of arguments,
and I don't know how to do this in R, without perhaps writing default
values to the formals() of my function, or writing to the environment
object of a function. For context, my definition of partially apply
is: "fix some of the arguments, leaving the others as variables,
return a new function that takes the un-fixed arguments from the
original function as arguments"
The issue is that I would like several different sets of arguments for
the "partially applied" phase, and I think that would involve copying
the function to several different places with the above methods.
Alternately, I could hard-code the partial applications using a
function() form, but I would prefer not to do this, as there will be a
sizable number of these closures needed and I'd prefer to automate the
process.
Thanks!
--Mog
More information about the R-help
mailing list