>> # Use of Curry >> adaptIntegrate(Curry(f, a=0.2), lower=0, upper=2) > > The _concept_ of currying is useful, and maybe more can be done to > provide guidance and education on how to do it, but adding a function > that sometimes works and somesimes does surprising things is not the > way to go.
What about an alternative approach? Curry <- function(FUN, ...) { args <- match.call(expand.dots = FALSE)$... args$... <- as.name("...") curry_call <- as.call(c(list(as.name("FUN")), args)) function(...) { eval(curry_call) } } Or maybe Curry <- function(FUN, ...) { args <- match.call(expand.dots = FALSE)$... args$... <- as.name("...") curry_call <- as.call(c(list(as.name("FUN")), args)) eval(bquote(function(...) .(curry_call))) } I think this is pretty close to what you'd get if you made an anonymous function (but I'm probably missing something) Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel