Skip to content

Instantly share code, notes, and snippets.

@bbbates
Last active August 29, 2015 14:09
Show Gist options
  • Save bbbates/05cb66644f59918a70d0 to your computer and use it in GitHub Desktop.
Save bbbates/05cb66644f59918a70d0 to your computer and use it in GitHub Desktop.
fizzbuzz - no conditionals
(defn fizzbuzz
[n]
(let [r [(= 0 (mod n 3)) (= 0 (mod n 5))]]
(get {[true false] "fizz" [false true] "buzz" [true true] "fizzbuzz"} r n)))
(map fizzbuzz (range 1 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment