_评论者:bronsa_
Alex,发布的示例不再可复制,因为`(range)`不再生成chunked-seq。
另一方面,用`(range n)`替换`(range)`在ticket描述中的代码示例中的`(range Long/MAX_VALUE)`就足够使错误再次出现。
Clojure 1.8.0-master-SNAPSHOT
user=> (def nums (drop 2 (range Long/MAX_VALUE)))
#'user/nums
(def primes (cons (first nums)
(lazy-seq (->>
(rest nums)
(remove
(fn [x]
(let [dividors (take-while #(<= (* % %) x)
primes)]
(println (str "primes = " primes))
(some #(= 0 (rem x %)) dividors))))))))
#'user/primes
user=> (取5个素数)
(primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
primes = (2)
2 3 5 7 9)