<div dir="ltr"><div><div>In his second version (see below), Matthew was basically encapsulating what you have written inside (yield ...).<br></div>Would you mind to explain what differences that makes? I've read the docs but I'm still confused about `yield'.<br>
<br>>> >> > #lang at-exp racket<br>>> >> > (require plot<br>>> >> > racket/gui/base)<br>>> >> > (plot-new-window? #t)<br>>> >> > (yield<br>
>> >> > (thread<br>>> >> > (lambda ()<br>>> >> > (let loop ()<br>>> >> > (let ((dummy (read)))<br>>> >> > (if (and (number? dummy) (zero? dummy))<br>
>> >> > (void)<br>>> >> > (begin<br>>> >> > ;; queue a callback instead of `plot' directly:<br>>> >> > (queue-callback<br>
>> >> > (lambda ()<br>>> >> > (plot (function (ë(x) (* x x)) -2 2))))<br>>> >> > (loop))))))))<br><br></div>Thanks,<br>Laurent<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 17, 2013 at 2:13 PM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>That way has the property that each plot window has its own thread of execution, which is probably not necessary (I don't know if plot windows communicate or if that matters), but if it were me, I'd probably just make one extra thread, not N, and I'd put the reading into the extra thread not the GUI, like the below. <br>
</div><div><br></div><div><div>#lang racket/gui</div><div>(require plot)</div><div>(plot-new-window? #t)</div><div>(define (do-one)</div><div> (define dummy (read))</div><div> (cond</div><div> [(and (number? dummy) (zero? dummy))</div>
<div> #f]</div><div> [else</div><div> (queue-callback</div><div> (ë () </div><div> (plot (function (ë (x) (* x x)) -2 2))))</div><div> #t]))</div><div><br></div><div>(when (do-one)</div><div> (void</div>
<div> (thread</div><div> (ë ()</div><div> (let loop ()</div><div> (when (do-one)</div><div> (loop)))))))</div></div><div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">
On Sun, Mar 17, 2013 at 4:42 AM, Laurent <span dir="ltr"><<a href="mailto:laurent.orseau@gmail.com" target="_blank">laurent.orseau@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div>So, does this means that Deren's program from<br><a href="http://lists.racket-lang.org/users/archive/2012-April/051490.html" target="_blank">http://lists.racket-lang.org/users/archive/2012-April/051490.html</a><br>
would then look like that:<br><br>#lang racket<br>(require plot)<br>(plot-new-window? #t)<br>(let loop ()<br> (let ((dummy (read)))<br> (if (and (number? dummy) (zero? dummy))<br> (void)<br> (begin<br> (parameterize ([current-eventspace (make-eventspace)])<br>
(plot (function (ë(x) (* x x)) -2 2)))<br> (loop)))))<br><br></div>?<span><font color="#888888"><br><br></font></span></div><span><font color="#888888">Laurent<br></font></span></div>
<div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Sun, Mar 17, 2013 at 7:15 AM, Eli Barzilay <span dir="ltr"><<a href="mailto:eli@barzilay.org" target="_blank">eli@barzilay.org</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div>On Thursday, Robby Findler wrote:<br>
> Also: I don't think that you need a parameter for this default. the<br>
> current-eventspace parameter would already do this job.<br>
<br>
</div>IOW, Robby wants no keyword or parameter, just the default behavior,<br>
and if there's a problem with that then people would deal with it like<br>
with any other gui code. FWIW, I'm on that side too.<br>
<div><br>
--<br>
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:<br>
<a href="http://barzilay.org/" target="_blank">http://barzilay.org/</a> Maze is Life!<br>
</div></div></div><div><div><div>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></div></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>