Robert Dober
3/24/2006 3:24:00 PM
On 3/24/06, Ross Bamford <rossrt@roscopeco.co.uk> wrote:
>
> On Fri, 2006-03-24 at 23:43 +0900, Robert Dober wrote:
> >
> > Well I got it!
> > Was I missing something or is my solution really better?
>
> Well, if you're going to cheat and use return ... :)
>
> Seriously though, I like that one. Shows how it's important to remember
> the 'normal' stuff when you're thinking in this high level stuff :)
>
> And yes, I guess it is better:
>
> user system total real
> Iterator1 4.730000 0.040000 4.770000 ( 4.877037)
> Iterator2 2.840000 0.050000 2.890000 ( 2.960747)
> Iterator3 2.800000 0.130000 2.930000 ( 2.998121)
> Iterator4 2.040000 0.020000 2.060000 ( 2.131763)
>
> (1 = my updated, easy to follow version of Peter's original, 2 = same
> version with one callcc and one catch, 3 = Peter's second
> implementation, 4 = your callcc/return implementation)
>
> As you can see, though, they're all pretty slow when it comes right down
> to it (this was only over (0...50000).to_a) - some of the
> FasterGenerator quiz entries I mentioned achieved quite amazing speeds
> over that many iterations and more - you should check them out.
>
> --
> Ross Bamford - rosco@roscopeco.REMOVE.co.uk
>
>
> I have no merit than ;), no it is true that I have not understood a bit of
your continuation stuff, when I realized what callcc really does, I realized
that I was wrong about the coroutines.
Ty for the acknowledgement but I learnt it from your code!
Cheers
--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.
- Albert Einstein