Skip to content

Instantly share code, notes, and snippets.

@taylorlapeyre
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save taylorlapeyre/dd53b80ee7760cc9b619 to your computer and use it in GitHub Desktop.

Select an option

Save taylorlapeyre/dd53b80ee7760cc9b619 to your computer and use it in GitHub Desktop.
(defn divisible?
"Returns true if the remainder of x / y is zero, else false."
[x y]
(zero? (rem x y)))
(defn fizzbuzz
"Returns Fizz if n is divisible by 3, buzz if n is divisible by 5,
and fizzbuzz if n is divisible by both."
[n]
(cond (divisible? n 15) "fizzbuzz"
(divisible? n 3) "fizz"
(divisible? n 5) "buzz"
:else n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment