[plt-scheme] writing to files

From: Marco Morazan (morazanm at gmail.com)
Date: Mon Jul 21 15:53:58 EDT 2008

Thanks guys for confirming I was not crazy. --Marco

On Mon, Jul 21, 2008 at 3:48 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Mon, 21 Jul 2008 14:52:40 -0400, "Marco Morazan" wrote:
>> Would someone be kind enough to point me in the right direction?
>>
>> [...]
>>
>> (define (w2file c filename)
>>   (let ((file (open-output-file
>>                (string-append
>>               "C:/Users/SHU-USER/Documents/Test/"
>>                  (symbol->string filename)
>>                  ".txt")
>>                #:mode 'text
>>                #:exists 'replace)))
>>     (begin
>>       (write2file c file)
>>       (close-output-port file)
>>     )))
>
>
> You've hit the awful R5RS/EoPL bug in 4.0.2 where `begin' in a
> internal-definition position gets evaluated twice. Removing the
> `begin's makes the program work correctly.
>
> This bug is fixed in SVN for the 4.0.3 or 4.1 release (whichever the
> next one turns out to be).
>
> Matthew
>
>


Posted on the users mailing list.