Re: [R] question about the "Y of R" article in the latest R news

From: Mark Kimpel <>
Date: Mon, 10 Nov 2008 11:52:57 -0500

Thanks, I appreciate both your comments and those of Gabor. For what its worth, after Gabor's clarification I checked the performance of Recall and found it to be intermediate between the base recursion example (function 's') and those of the 'Y of R' approach. As a teaching example, however, the 'Y of R' approach would seem to be a very nice approach to dissect. In my day to day work I don't often see functions used as arguments, so this is stretching me a bit in a positive way.

Thanks so much for your contributions to the R project and to R News,


Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry Indiana University School of Medicine

15032 Hunter Court, Westfield, IN 46074

(317) 490-5129 Work, & Mobile & VoiceMail (317) 399-1219 Home
Skype: mkimpel

"The real problem is not whether machines think but whether men do." -- B. F. Skinner

On Sun, Nov 9, 2008 at 3:59 PM, Vincent Carey 525-2265 <> wrote:

> On Sat, 8 Nov 2008, Mark Kimpel wrote:
> > I found the article the "Y of R" in the latest R news to be very
> > interesting. It is certainly challenging me to learn more about how R
> works
> > "under the hood" as the author states. What is less clear to me is
> whether
> > this approach is primarily for teaching purposes or has a real world
> > application. What is meant by "fragility of reliance on the function
> > name defined as a global variable" as a downside to the classical
> recursive
> > formulation of function "s"? How can that impact the average R
> programmer?
> >
> > Beyond that, empiricist that I am, I decided to put the examples to the
> > test. My source code and output is below, but the bottom line consists of
> 2
> > observations:
> >
> > - The Y function approach using csum is consistently slower on my
> machine
> > that the s function approach
> > - The Y function using csum gives recursive error with high input
> values
> > just like the s function does
> > - The Y function in fact reaches the limit of recursion BEFORE the s
> > function does
> >
> > Given that it is slower, is more cumbersome to write, and has a lower
> > nesting limit than the classical approach, I wonder about its utility for
> > the average programmer (or somewhat below average programmer like me).
> >
> Thanks for your comments and to Gabor for some clarification. Your
> empirical study adds to our knowledge of the situation. I considered
> the implementation of Y in R to be of conceptual interest only, and I
> probably should have said that. Even the conceptual considerations
> may admit of improvement, as there are use-mention distinctions that are
> murky in various points in the text. But I will not be able to revisit
> this, apart from dealing with major misconceptions if such exist, in the
> foreseable future.

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 10 Nov 2008 - 16:57:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 10 Nov 2008 - 17:30:23 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive