Skip to content

Instantly share code, notes, and snippets.

@schuyler
Created January 31, 2011 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schuyler/804873 to your computer and use it in GitHub Desktop.
Save schuyler/804873 to your computer and use it in GitHub Desktop.
why is this not evaluated lazily?
(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