Last active
August 29, 2015 14:21
-
-
Save rafaelcaricio/596b0fb20e367695155c to your computer and use it in GitHub Desktop.
testing clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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