Talk:Anonymous recursion: Difference between revisions

→‎Recursion implies a function: If the Ruby version matters, say so properly!
(→‎completion of the task: Removed REXX comments.)
(→‎Recursion implies a function: If the Ruby version matters, say so properly!)
Line 185:
:: Is there something I'm doing wrong? The above version of 'fib' just returns its argument. --[[User:Abu|Abu]] 09:15, 12 January 2011 (UTC)
::: You probably used Ruby 1.8, while I used Ruby 1.9. They changed the rules for when a block parameter has the same name as a variable outside the block. I misunderstood the rules for Ruby 1.8, and wrote a recursive singleton method, when a recursive block would have worked. --[[User:Kernigh|Kernigh]] 04:04, 11 February 2011 (UTC)
:::: Make sure you use the {{tmpl|works with}} template to document which version of Ruby is required. Let's ''capture'' that information properly instead of leaving it languishing in a comment on a talk page! –[[User:Dkf|Donal Fellows]] 10:45, 11 February 2011 (UTC)
 
:Concerning "recursion implies a function", it depends on what you consider a function. The GOSOB in the Basic code snippet is not really a function call. That's why I used the term "call" instead of "function". A Forth solution would involve two or three new immediate control words, similar to BEGIN/WHILE/REPEAT. In the PicoLisp version (and also in your second Ruby version, if I understand it right), the first pass through the 'recur' body does not actually involve a function call, but it is executed in the context of the surrounding function. --[[User:Abu|Abu]] 07:57, 9 January 2011 (UTC)
Anonymous user