Created
January 31, 2011 21:39
-
-
Save schuyler/804873 to your computer and use it in GitHub Desktop.
why is this not evaluated lazily?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn divisible-by? [n factors] (some #(zero? (rem n %)) factors)) | |
(defn next-prime [factors] (first (drop-while #(divisible-by? % factors) (iterate inc (first factors))))) | |
(defn primes [factors] (lazy-seq (primes (cons (next-prime factors) factors)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment