<div class="gmail_quote">On Mon, Feb 20, 2012 at 00:55, Joe Gilray <span dir="ltr"><<a href="mailto:jgilray@gmail.com">jgilray@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Rodolfo,<div><br></div><div>Thanks for the suggestions. Your re-factoring (no pun intended) of the conds really cleaned things up. Much appreciated.</div><div><br></div><div>About the unnecessary loops, good point, I simply changed to starting with end set to 10 instead of 1000 and I think that helps a lot. I know that there are other gross inefficiencies as well (for example, if primes-from-to gets called to just add a few primes to the list it is very slow as it goes through the whole list. A better implementation would "know" that the values on storedlst are already checked and skip checking them.<br>
</div></blockquote></div><br><br>Maybe you could generate the list of primes using... hmm.. Generators!<br><br><a href="http://docs.racket-lang.org/reference/Generators.html">http://docs.racket-lang.org/reference/Generators.html</a><br>
<br>You could have something like (primes-up-to n) yield one prime at a time, up to n (the number to be factored).<br><br><br>[]'s<br><br>Rodolfo Carvalho<br>