Ad

Output numbers from 1 to x. If the number is divisible by 3, replace it with “Fizz”. If it is divisible by 5, replace it with “Buzz”. If it is divisible by 3 and 5 replace it with “FizzBuzz”.

(ns fizzbuzz.core)

(defn divisible-by? [divisor number]
  (zero? (mod number divisor)))
  
(defn fizzbuzz [x]
  (map #(cond 
          (divisible-by? 15 %) "FizzBuzz"
          (divisible-by? 5 %) "Buzz"
          (divisible-by? 3 %) "Fizz"
          :else %)
        (range 1 (inc x))))