Well, why reinvent the wheel :)

https://github.com/richhickey/clojure-contrib/blob/78ee9b3e64c5ac6082fb223fc79292175e8e4f0c/src/main/clojure/clojure/contrib/lazy_seqs.clj#L66

Cheers,
Alf



On Thu, Sep 22, 2011 at 19:20, Wilker <wilkerlu...@gmail.com> wrote:
> Alf, I mean it will be even better if you just generate an infinite lazy
> sequence that generates primes, I mean will be really more cool :)
> ---
> Wilker Lúcio
> http://about.me/wilkerlucio/bio
> Kajabi Consultant
> +55 81 82556600
>
>
> On Thu, Sep 22, 2011 at 1:36 PM, Alf Kristian Støyle
> <alf.krist...@gmail.com> wrote:
>>
>> Jup, that solved the problem. Lesson learned.
>>
>> Thanks :)
>> Alf
>>
>>
>>
>> On Thu, Sep 22, 2011 at 17:54, Meikel Brandmeyer (kotarak) <m...@kotka.de>
>> wrote:
>> > Hi,
>> >
>> > Am Donnerstag, 22. September 2011 17:43:30 UTC+2 schrieb Alf:
>> >>
>> >> What am I doing wrong here, will filter/remove or something else give
>> >> StackOverflowError when used incorrectly?
>> >
>> > Yes. You pile lazy seq on lazy seq on lazy seq on .... and then realise
>> > the
>> > first element. This kicks off a cascade which finally causes the stack
>> > overflow when your lazy seq pile is large enough.
>> >
>> > Put a doall around the remove. This will realise the seq immediatelly
>> > and
>> > the cascade cannot happen. So it should solve the issue.
>> >
>> > Sincerely
>> > Meikel
>> >
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clojure@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with
>> > your
>> > first post.
>> > To unsubscribe from this group, send email to
>> > clojure+unsubscr...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/clojure?hl=en
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to