[R] functional programming question

From: Erich Neuwirth <erich.neuwirth_at_univie.ac.at>
Date: Sun 05 Feb 2006 - 05:28:02 EST

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

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sun Feb 05 05:39:09 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:22 EST