[racket] static variables question

From: Joe Gilray (jgilray at gmail.com)
Date: Mon Feb 20 02:21:47 EST 2012

Hi Rodolfo,

Thanks for the suggestion.  I ended up reading quite a bit about generators
and found this very appropriate and interesting page:


On Sun, Feb 19, 2012 at 7:05 PM, Rodolfo Carvalho <rhcarvalho at gmail.com>wrote:

> 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/20120219/1ee75a86/attachment.html>

Posted on the users mailing list.