; This function is part of a great solution to the "fizzbuzz" interview question.
; Let's review
; Players take turns to count incrementally,
; replacing any number divisible by three with the word "fizz",
; any number divisible by five with the word "buzz", and
; any number divisible by both three and five with the word "fizzbuzz".
(defn fizz-buzz [n]
(condp #(zero? (mod %2 %1)) n
15 "fizzbuzz"
3 "fizz"
5 "buzz"
n))
(into [] (map fizz-buzz) (range 1 20))
;;=> [1 2 "fizz" 4 "buzz" "fizz" 7 8 "fizz" "buzz"
;; 11 "fizz" 13 14 "fizzbuzz" 16 17 "fizz" 19]