Skip to content

Instantly share code, notes, and snippets.

@zerg000000
Created January 6, 2012 03:02
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 zerg000000/1568738 to your computer and use it in GitHub Desktop.
Save zerg000000/1568738 to your computer and use it in GitHub Desktop.
A clojure version of fizzbuzz in 5 minutes
(defn mod3? [num] (= (mod num 3) 0))
(defn mod5? [num] (= (mod num 5) 0))
(defn fizzbuzz [num] (cond (and (mod3? num) (mod5? num)) "FizzBuzz"
(mod5? num) "Buzz"
(mod3? num) "Fizz"
:else num))
(map fizzbuzz (range 1 101))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment