range-peek
> (filter (partial prime? primes))
> first)]
> (cons p (lazy-seq (sieve (conj primes p)))
>
> (last (take 1 (sieve)))
>
> This version keeps the visited primes in a vector so it will grow in
> memory but won’t overfl
All -
I'm trying to generate a lazy sequence of primes using Erastosthenes Sieve
(from Abelson & Sussman) and am encountering some issues with lazy sequence.
Here's what I have:
---
(defn divisible?
[input numerator]
(= 0 (mod input numerator)))
(defn sieve
[stream]
(lazy-seq
(con