Created
July 29, 2015 12:05
-
-
Save gabehollombe/71cdd2458591a32811b7 to your computer and use it in GitHub Desktop.
FizzBuzz without conditionals
This file contains 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
(defn fizz-buzz-n | |
[n] | |
(or | |
(and (zero? (mod n 15)) "FizzBuzz") | |
(and (zero? (mod n 3)) "Fizz") | |
(and (zero? (mod n 5)) "Buzz") | |
n)) | |
(println (clojure.string/join "\n" | |
(->> (take 25 (iterate inc 1)) | |
(map fizz-buzz-n)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment