Created
October 30, 2015 10:36
-
-
Save jirkapenzes/0d9aa244f077480208ee to your computer and use it in GitHub Desktop.
GDG Jihlava talk - fizzbuzz demo
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 gdg-jihlava) | |
;1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz | |
(defn fizz-buzz-number [number] | |
(cond | |
(= 0 (mod number 3) (mod number 5)) :fizz/buzz | |
(= 0 (mod number 3)) :fizz | |
(= 0 (mod number 5)) :buzz | |
:else number)) | |
(defn fizzbuzz [n] | |
(map fizz-buzz-number (range 1 (inc n)))) | |
(fizzbuzz 15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment