[racket] static variables question

From: Rodolfo Carvalho (rhcarvalho at gmail.com)
Date: Sun Feb 19 22:05:00 EST 2012

On Mon, Feb 20, 2012 at 00:55, Joe Gilray <jgilray at gmail.com> wrote:

> Hi Rodolfo,
>
> Thanks for the suggestions.  Your re-factoring (no pun intended) of the
> conds really cleaned things up.  Much appreciated.
>
> 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.
>


Maybe you could generate the list of primes using... hmm.. Generators!

http://docs.racket-lang.org/reference/Generators.html

You could have something like (primes-up-to n) yield one prime at a time,
up to n (the number to be factored).


[]'s

Rodolfo Carvalho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120220/e5624223/attachment.html>

Posted on the users mailing list.