[plt-scheme] Scheme and R

From: Neil Toronto (ntoronto at cs.byu.edu)
Date: Thu Mar 26 13:24:27 EDT 2009

Prabhakar Ragde wrote:
> R is a free, open-source language for statistical computing that is 
> gaining in popularity (to the extent that the New York Times has written 
> about it). The required stats course that our students take has 
> apparently been using it for a while.
> One of the inspirations for R was Scheme. R is not purely functional, 
> but has lexical scoping, closures, and many built-in higher-order 
> functions.
> I'm wondering if anyone on this list has experience with teaching R or 
> with making explicit the connections between R and Scheme. I'd like to 
> take more notice of this in our first-year CS classes, and help prepare 
> students for the use of R in their second-year stats class. --PR

I haven't taught R or hooked it up to Scheme before, but I have used it 
for statistical work.

The main reasons to use R aren't anything to do with functional 
programming. Most users tend to use it imperatively and only make use of 
higher-order stuff when a built-in function requires it. The real draws 
are its comprehensive libraries and friendliness to statistics. That is, 
it's got every distribution and function you would typically need, if it 
doesn't someone has usually made a library, most simple things are 
vectorized, and its graphs are easy to make and look very nice.

As a language it's rather weak and inconsistent. Sungwoo Park's analysis 
is good, so I'll defer to him:


For statistics it can be a lifesaver, but I don't think I'd ever use it 
to teach or even illustrate functional programming concepts.


Posted on the users mailing list.