Sorry, that should have been
(def primes
(concat
[2]
(lazy-seq
(let [primes-from
(fn primes-from
[n]
(if (some #(zero? (rem n %))
(take-while #(<= (* % %) n) primes))
(recur (+ n 2))
(lazy-seq (cons n (primes-from (+ n 2))))))]
(primes-from 3)))))
Stu
> On 12 oct, 03:56, Stuart Halloway <[email protected]> wrote:
>
> I've tried your definition
>
>> (def primes
>> (concat
>> [2]
>> (let [primes-from
>> (fn primes-from
>> [n]
>> (if (some #(zero? (rem n %))
>> (take-while #(<= (* % %) n) primes))
>> (recur (+ n 2))
>> (lazy-seq (cons n (primes-from (+ n 2))))))]
>> (primes-from 2))))
>
> using clojure 1.2 and I've got:
>
> user=> java.lang.IllegalStateException: Var user/primes is unbound.
> (NO_SOURCE_FILE:27)
>
> Any idea of what is going on?
>
> Thanks.
>
> JM
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en