FWIW there's a lot of prior threads about this problem in various
guises. The one I like to refer people to is on stackoverflow, and is
for exactly what you're doing:
http://stackoverflow.com/questions/2946764/recursive-function-causing-a-stack-overflow
On Sep 22, 9:36 am, Alf Kristian Støyle
wro
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 wrote:
> Alf, I mean it will be even better if you just generate an
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 wrote:
> Jup, that
Jup, that solved the problem. Lesson learned.
Thanks :)
Alf
On Thu, Sep 22, 2011 at 17:54, Meikel Brandmeyer (kotarak)
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
>> StackOverflowErr
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 c
Hi guys, playing around with different ways of creating primes. The
following implementation is probably not very efficient, but it does
seem to be correct. The problem is that when run it gives a
java.lang.StackOverflowError.
(defn primes[num]
(let [possible (range 2 num)]
(loop [current 2