June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,19 +1,4 @@
|
|||
;;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))))
|
||||
(take 100
|
||||
(map #(if (pos? (compare %1 %2)) %1 %2)
|
||||
(map str (drop 1 (range)))
|
||||
(map str (cycle ["" "" "Fizz"]) (cycle ["" "" "" "" "Buzz"]))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue