[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Ruby tail recursion
From:       Neil Stevens <neil () hakubi ! us>
Date:       2005-12-17 6:07:46
Message-ID: KSNof.2246$aU4.1260 () trnddc06
[Download RAW message or body]

Jakub Hegenbart wrote:
> Tail calls are essentialy safe GOTOs with argument passing, there is a
> potential for performance gain. ;-) But in Ruby, its benefits wouldn't
> be that noticeable, I guess...I kind of don't think that the programming
> style that Ruby encourages is a good candidate for tail call
> optimization. :-D

Good point.  Tail-call recursion is just a form of recursion that's easy
to turn into iteration, but (at least to me) one of ruby's strengths is
its iterators, so one might as well just write code in iterative form
instead of tail-call recursive form!

-- 
Neil Stevens - neil@hakubi.us

'A republic, if you can keep it.' -- Benjamin Franklin

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic