2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
19
Task/FizzBuzz/Clojure/fizzbuzz-11.clj
Normal file
19
Task/FizzBuzz/Clojure/fizzbuzz-11.clj
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
;;Using clojure maps
|
||||
(defn fizzbuzz
|
||||
[n]
|
||||
(let [rule {3 "Fizz"
|
||||
5 "Buzz"}
|
||||
divs (->> rule
|
||||
(map first)
|
||||
sort
|
||||
(filter (comp (partial = 0)
|
||||
(partial rem n))))]
|
||||
(if (empty? divs)
|
||||
(str n)
|
||||
(->> divs
|
||||
(map rule)
|
||||
(apply str)))))
|
||||
|
||||
(defn allfizzbuzz
|
||||
[max]
|
||||
(map fizzbuzz (range 1 (inc max))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue