[R] functional programming question

Erich Neuwirth erich.neuwirth at univie.ac.at
Sat Feb 4 19:28:02 CET 2006


Many functional programming languages have a metafunction
which does the following:
it has two arguments, a function and a list of objects, all of the same
type.
The argument function itself has two arguments of the same type as all
the list objects, and the result of this function also is of the same type.
then
metafunction(f,list(x1,x2,....xn)) produces
f(x1,f(x2,f(x3,....,f(xn-1,xn)))..)
Does R have such a function, or do I need to code it myself?
In Scheme (Mathematica), this metafunction is called fold (Fold).


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459




More information about the R-help mailing list