Skip to content

Instantly share code, notes, and snippets.

@gabehollombe
Created July 29, 2015 12:05
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 gabehollombe/71cdd2458591a32811b7 to your computer and use it in GitHub Desktop.
Save gabehollombe/71cdd2458591a32811b7 to your computer and use it in GitHub Desktop.
FizzBuzz without conditionals
(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