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

Vincent Carey 525-2265 stvjc at channing.harvard.edu
Sun Nov 9 21:59:22 CET 2008


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.



More information about the R-help mailing list