[plt-scheme] Syntax question - begin in threads

From: Chongkai Zhu (u0476504 at utah.edu)
Date: Tue Jan 3 19:56:45 EST 2006

I run this on my computer:

(define x 0)
(define t1
   (lambda ()
     (sleep 5)
     (set! x 10))))

No errors. Everything work as it should.

欢迎使用 DrScheme, 版本 300.3-svn29dec2005.
语言: Textual (MzScheme, 包含R5RS).
> x
> x

Maybe you need also provide which version of DrScheme you are using,

Chongkai Zhu  

======= At 2006-01-03, 16:40:33 Greg Woodhouse wrote: =======

>I've been experimenting with threads, and find that this code works
>just fine
>(define x 0)
>(define t1
>  (thread
>   (lambda ()
>     (begin
>       (sleep 5)
>       (set! x 10)))))
>but, if I leave the begin out, I get an error (though the thread runs).
>I thought of begin as a *sequencing* command. What if I have several
>expressions that need to be evaluated, but I don't care about the
>Am I misunderstanding the role of begin?
>Gregory Woodhouse  <gregory.woodhouse at sbcglobal.net>
>"If you give someone Fortran, he has Fortran.
>If you give someone Lisp, he has any language he pleases."
>--Guy L. Steele, Jr.?
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.