Skip to content

Instantly share code, notes, and snippets.

@jeremyheiler
Created May 16, 2013 19:31
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 jeremyheiler/5594379 to your computer and use it in GitHub Desktop.
Save jeremyheiler/5594379 to your computer and use it in GitHub Desktop.
Fizz Buzz Fibonacci!
(defn fibonacci
([] (fibonacci 1 1))
([x y] (cons x (lazy-seq (fibonacci y (+ x y))))))
(defn fizz-buzz
[n]
(let [fizz (zero? (mod n 3)) buzz (zero? (mod n 5))]
(cond
(and fizz buzz) "FizzBuzz"
fizz "Fizz"
buzz "Buzz"
:else n)))
(take 50 (map fizz-buzz (fibonacci)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment