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 ------------------------------------------------------------ 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 < [EMAIL PROTECTED]> 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]] ______________________________________________ R-help@r-project.org 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.