Nothing about futures here either, but shouldn't the sum of the list be kept aside it somehow? You're recalculating the sum of the selected values many many times here.<br><br><div class="gmail_quote">On Wed, Jul 28, 2010 at 21:44, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
(Nothing about futures. But may I recommend a nice and simple 'optimization':<br>
<br>
(cond<br>
[(= 1 (length values)) ...]<br>
<br>
adds quite some complexity to a recursive function over a list.<br>
I'd use<br>
<br>
(empty? (rest values))<br>
<br>
instead.<br>
<br>
Also, I assume that you will protect your function with a<br>
contract or a main function.<br>
<font color="#888888"><br>
-- Matthias)<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
On Jul 28, 2010, at 4:35 PM, Joe Snikeris wrote:<br>
<br>
> All,<br>
><br>
> Please see: <a href="http://pastie.org/1064484" target="_blank">http://pastie.org/1064484</a><br>
><br>
> Apparently, spawning futures recursively is a bad idea. This problem<br>
> seems like it should be easily parallelizable. What am I doing wrong<br>
> here?<br>
><br>
> Thanks,<br>
> Joe<br>
> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
<br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
</div></div></blockquote></div><br>