Skip to content

Instantly share code, notes, and snippets.

@rafaelcaricio
Last active August 29, 2015 14:21
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 rafaelcaricio/596b0fb20e367695155c to your computer and use it in GitHub Desktop.
Save rafaelcaricio/596b0fb20e367695155c to your computer and use it in GitHub Desktop.
testing clojure
(defn fizzbuzz [max_value]
(fizzbuzz_acc max_value 1))
(defn fizzbuzz_acc [max_value acc]
(if (<= acc max_value)
(do (if (is_fizzbuzz acc)
(println "fizzbuzz")
(if (is_fizz acc)
(println "fizz")
(if (is_buzz acc)
(println "buzz")
(println acc))))
(recur max_value (+ 1 acc)))))
(defn is_fizzbuzz [value]
(and (is_fizz value) (is_buzz value)))
(defn is_fizz [value]
(= (mod value 3) 0))
(defn is_buzz [value]
(= (mod value 5) 0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment