<div dir="ltr">Well, just a quick look at the screenshot: I think pair? will block only when it used in a higher-order way, ie:<div><br></div><div style> (define (f g) (g 17))</div><div style> (f pair?)</div><div style><br>
</div><div style>instead of:</div><div style><br></div><div style> (pair? 17)</div><div style><br></div><div style>or, for that matter:</div><div style><br></div><div style> (define (f g) (g 17))</div><div style> (g (lambda (x) (pair? x)))</div>
<div style><br></div><div style>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 21, 2013 at 3:03 PM, Dmitry Cherkassov <span dir="ltr"><<a href="mailto:dcherkassov@gmail.com" target="_blank">dcherkassov@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 class="gmail_quote">Hi list.<br>
I've been doing a simple ray tracer[1] and decided to parallelize it using<br>
futures.<br>
<br>
I've tried to use flonums everywhere and added (in-range) to loops [3]<br>
(over x and y coordinates).<br>
<br>
The problem is that execution of future is blocked seriously.<br>
(apparently by the value primitive) [2]<br>
<br>
Are there any ideas why it doesn't work?<br>
<br>
I use racket v5.3.3.<br>
<br>
[1] Complete source code: <a href="http://pastebin.com/EGSzR1Tv" target="_blank">http://pastebin.com/EGSzR1Tv</a><br>
<br>
[2] Future visualizer screenshot: <a href="http://ompldr.org/vaGpiaQ" target="_blank">http://ompldr.org/vaGpiaQ</a><br>
Invoked via<br>
(require future-visualizer)<br>
(visualize-futures (run-no-render))<br>
<br>
[3] Source code for main loop:<br>
(define (render-scene-dummy object-list)<br>
(let* ([f (future<br>
(lambda ()<br>
(for* ([x (in-range (/ screen-width 2))]<br>
[y (in-range screen-height)])<br>
(let* ([ray-res (ray-cast x y object-list)]<br>
[pix-col (point-col (int-res-p ray-res))])<br>
#t))<br>
))])<br>
<br>
(for* ([x (in-range (/ screen-width 2) screen-width)]<br>
[y (in-range screen-height)])<br>
(let* ([ray-res (ray-cast x y object-list)]<br>
[pix-col (point-col (int-res-p ray-res))])<br>
#t))<br>
(touch f)))<span class="HOEnZb"><font color="#888888"><br>
</font></span></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br>With best regards,<br>Dmitry<br>
</font></span><br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>