Thanks for the help, everyone.  This works great.  I especially like
handle-evt -- I had seen it in the Reference when I was reading about
events but didn't understand what it did.  It really makes this easy.



On Wed, Jan 25, 2017 at 8:17 PM, Jon Zeppieri <zeppi...@gmail.com> wrote:

> On Wed, Jan 25, 2017 at 8:03 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
> >
> > The `handle-evt` constructor does that.
> >
> > For example, this loop will print "one" or "two" pseudorandomly,
> depending on whether the first or second semaphore is chosen:
> >
> >  (let loop ()
> >    (define e1
> >     (handle-evt (make-semaphore 1)
> >                 (lambda (v)
> >                   (printf "one\n")
> >                   (loop))))
> >    (define e2
> >     (handle-evt (make-semaphore 1)
> >                 (lambda (v)
> >                   (printf "two\n")
> >                   (loop))))
> >    (sync e1 e2))
>
> Oh, that's a lot more convenient than I realized. Guess I never gave
> enough thought to the value of the handler being called in tail
> position w.r.t. the sync. -J
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to