[racket] generator performance (again)

From: Danny Yoo (dyoo at hashcollision.org)
Date: Sun Oct 7 19:23:51 EDT 2012

On Sun, Oct 7, 2012 at 11:34 AM, Patrick Useldinger
<uselpa.list at gmail.com> wrote:
> Hi,
> following up on my earlier thread (sep 16th) on the same subject, I tried to
> compare some solutions generating fibonacci series in a lazy way: via a
> closure, via generators and using delay/force.

Hmmm!  Looking at it now...  Wait: your definition of fibo-gen2 is not
exactly equivalent to the others in terms of work when verbose is off.

Change your definition to:

(define (run-fibo-gen2 count verbose)
  (printf "fibo-gen2 : ")
  (for ( [i (in-range count)] )
    (define next-val (fibo-gen))
    (when verbose (printf "~a " next-val)))
  (when verbose (printf "\n")))

Otherwise, the third version doesn't even touch the sequence unless
verbosity is on.  How do the results compare once you make this

Posted on the users mailing list.