[plt-scheme] [swindle] dotimes 'bug'

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Fri Jul 28 12:18:48 EDT 2006

David Hansen skrev:
> Hello,
> sorry if this is the wrong list but i haven't found a better
> group on gmane.
> The upper bound of swindles `dotimes' macro is evaluated each
> iteration:
>> (dotimes (i (begin (display "xxx") 10)) (display i))
> xxx0xxx1xxx2xxx3xxx4xxx5xxx6xxx7xxx8xxx9xxx
> This does not happen in e.g. Emacs Lisp or SBCL (and i guess
> most users wouldn't suspect this behavior and it's not
> documented).  So i would call it a bug.

As an alternative you can use the dotimes from control.plt:


   Welcome to DrScheme, version 301.
   Language: Pretty Big (includes MrEd and Advanced Student).
   > (require (only (planet "control.scm" ("soegaard" "control.plt"))
   > (dotimes (i (begin (display "xxx") 10)) (display i))

Jens Axel Søgaard

Posted on the users mailing list.