> From: Mathieu Bouchard > Subject: [ruby-talk:11181] Re: Generators (was: RCR Summary 02/16/01 > -suspend) [...] > Despite a regular functional implementation of fib(n) being in O(fib(n)) > time (that is, O(1.618**n) time), the implementation with generators is in > O(n) time like yours [*]. The only difference is callcc (which I think is > quite slow, but I don't know how it's implemented). > > I don't see how fib wouldn't be a good example. The existence of an > O(fib(n)) solution is irrelevant. You can design a slow solution to every > problem possible. I was curious how the ``callcc'' solution (much more interesting IMO) compares with a straightforward ``suspendable'' solution. Fib is fine a example - but in my loop I reinitialized to ``a = b = 1'' after 30 iterations (you have to alter the callcc solution a bit for this) to get a more meaningful comparison. [..] Christoph