Created
March 18, 2013 20:16
-
-
Save khill/5190432 to your computer and use it in GitHub Desktop.
Fizzbuzz in Clojure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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