Sieve of Eratosthenes [was Re: A Pipe to the Future]
Jason Johnson
jason.johnson.081 at gmail.com
Thu Sep 6 15:51:11 UTC 2007
On 9/6/07, Simon Guest <simon.guest at tesujimath.org> wrote:
>
> I had a play with this; it's pretty cool.
Ausome, thanks!
> Note that LazyList delay:
> should be LazyValue delay: (oh, and enumerateFrom with one m).
Ack, I obviously didn't test it at all. I'm glad that was all that
was wrong. :) But I should refactor that since it's now clear that
an already delayed object never seems to get passed in practice as the
second argument.
> Being able to type
> (allPrimes take: 100) asOrderedCollection
> is rather good.
>
> cheers,
> Simon
Yea, I hope you find it useful. I built it for my recurrence rule
implementation. If you add entries to the list using #insertUnique:
(I know, I know, subclass and specialize) then you can lazily merge it
with another list, or even filter it against another infinite lazy
list. You can download the ICal package from Squeaksource (look for
the versions with jbj or jj or something like that at the end) to see
what I use it for.
More information about the Squeak-dev
mailing list
|