Skip to content

Instantly share code, notes, and snippets.

@benkamphaus
Created August 5, 2014 16:47
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 benkamphaus/de44380768e6dbab64be to your computer and use it in GitHub Desktop.
Save benkamphaus/de44380768e6dbab64be to your computer and use it in GitHub Desktop.
FizzBuzz for laughs in Clojure
(defn fbuzz [x]
(let [divides (fn [x y]
(= (rem x y) 0))]
(cond (divides x (* 5 3)) "FizzBuzz"
(divides x 5) "Buzz"
(divides x 3) "Fizz"
:else x)))
(doseq [x (map fbuzz (range 1 101))] (print (str x ", ")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment