Skip to content

Instantly share code, notes, and snippets.

@khill
Created March 18, 2013 20:16
Show Gist options
  • Select an option

  • Save khill/5190432 to your computer and use it in GitHub Desktop.

Select an option

Save khill/5190432 to your computer and use it in GitHub Desktop.
Fizzbuzz in Clojure
(ns fizzbuzz)
(defn evenly-divisible [number divisor]
(zero? (mod number divisor))
)
(defn fizzbuzz [n]
(let [diviz (partial evenly-divisible n)]
(cond
(and (diviz 3) (diviz 5))
"fizzbuzz"
(diviz 3)
"fizz"
(diviz 5)
"buzz"
:default
n
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment