I mainly program in Common Lisp and use R for statistical analysis. While in R I miss the power and ease of use of Lisp, especially its many primitives such as find, member, cond, and (perhaps a bridge too far) loop. Has anyone created a package that includes R analogs to a subset of Lisp functions? Chris Elsaesser, PhD Principal Scientist, Machine Learning SPADAC Inc. 7921 Jones Branch Dr. Suite 600 McLean, VA 22102 703.371.7301 (m) 703.637.9421 (o)
Reduce, Filter and Map are part of R 2.6.0. Try ?Reduce On 9/6/07, Chris Elsaesser <chris.elsaesser at spadac.com> wrote:> I mainly program in Common Lisp and use R for statistical analysis. > > While in R I miss the power and ease of use of Lisp, especially its many > primitives such as find, member, cond, and (perhaps a bridge too far) > loop. > > Has anyone created a package that includes R analogs to a subset of Lisp > functions? > > > Chris Elsaesser, PhD > Principal Scientist, Machine Learning > SPADAC Inc. > 7921 Jones Branch Dr. Suite 600 > McLean, VA 22102 > > 703.371.7301 (m) > 703.637.9421 (o) > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Not all of us are familiar with lisp (I have done a little, but not enough to really understand what you are asking). If you tell us what find, member, cond, and loop do, or what functionality you are looking for, then we will have a better chance of telling you how to do the same in R. Just guessing by the names: The 'which' function may do something similar to 'find'. 'is.element' or '%in%' may do the same as 'member'. 'ifelse' and/or 'switch' may do what 'cond' does. 'replicate', 'lapply', 'sapply', 'while', and 'for' may give the functionality of 'loop'. Those are just guesses based on the names, I don't know what exactly they do, so if I am way off, then tell us what you want them to do. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Chris Elsaesser > Sent: Thursday, September 06, 2007 11:26 AM > To: r-help at stat.math.ethz.ch > Subject: [R] Lisp-like primitives in R > > I mainly program in Common Lisp and use R for statistical analysis. > > While in R I miss the power and ease of use of Lisp, > especially its many primitives such as find, member, cond, > and (perhaps a bridge too far) loop. > > Has anyone created a package that includes R analogs to a > subset of Lisp functions? > > > Chris Elsaesser, PhD > Principal Scientist, Machine Learning > SPADAC Inc. > 7921 Jones Branch Dr. Suite 600 > McLean, VA 22102 > > 703.371.7301 (m) > 703.637.9421 (o) > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
[Roland Rau]>[Fran?ois Pinard]>>I wonder what happened, for R to hide the underlying Scheme so fully, >>at least at the level of the surface language (despite there are >>hints).>"To further foster portability, we chose to write R in ANSI C...."Yes, of course. Scheme is also (often) implemented in C. I meant that R might have implemented a Scheme engine (or part of a Scheme engine, extended with appropriate data types) with a surface language (nearly the S language) which is purposely not Scheme, but could have been. If the gap is not extreme, one could dare dreaming that the Scheme engine in R be "completed", and Scheme offered as an alternate extension language. If you allow me to continue dreaming awake -- "they" told me "they" will let me free as long as I do not get dangerous! :-) -- part of the interest lies in the fact there are excellent Scheme compilers. If we could only find or devise some kind of marriage between a mature Scheme and R, so to speed up the non-vectorisable parts of R scripts...>If we are lucky and one of the original authors reads this thread they >might explain the situation further and better [...].In r-devel, maybe! We would be lucky if the authors really had time to read r-help. :-) -- Fran?ois Pinard http://pinard.progiciels-bpi.ca