Created
September 5, 2017 13:18
-
-
Save dbalan/89f13dd86e77509eb51ac12d1ee31991 to your computer and use it in GitHub Desktop.
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
(ns fizzbuzz.core | |
(:gen-class)) | |
(defn series [arg] (take arg (range))) | |
(defn fizzbuzz [arg] | |
(cond | |
(and (= 0 (mod arg 3)) (= 0 (mod arg 5))) "fizzbuzz" | |
(= 0 (mod arg 3)) "fizz" | |
(= 0 (mod arg 5)) "buzz" | |
:else arg)) | |
(defn parse-int [s] | |
(Integer. (re-find #"[0-9]*" s))) | |
(defn fizzseries [s] | |
(map fizzbuzz (series s))) | |
(defn -main | |
"I don't do a whole lot ... yet." | |
[& args] | |
(let [input (read-line)] | |
(map print (fizzseries (parse-int input))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment