> 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))) > }
Or one more approach: Curry <- function(FUN, ...) { args <- match.call(expand.dots = FALSE)$... args$... <- as.name("...") curry_call <- as.call(c(list(as.name("FUN")), args)) eval(call("function", as.pairlist(alist(... = )), curry_call)) } I'm not sure if there's a canonical way of programmatically creating functions. 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