On Wed, 3 Sep 2003, Simon Fear wrote: > Thanks to everyone for enlightening me about (f)(g). So I > suppose (f)(g)(h)... is OK as long as (f)(g) returns a function with > an argument (and so on)?
Indeed. As an example of what can be done recurse <- function(f) { g<- function(h) function(x) f(h(h))(x) g(g) } is not only syntactically valid, but arguably useful (it gives a way of writing anonymous recursive functions), so that recurse( function(self) function(n) if (n<2) 1 else n*self(n-1)) is an anonymous factorial function. -thomas ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help