Last active
October 16, 2024 12:00
-
-
Save zelark/a766274986d6212a8f85d7aa4c6d1179 to your computer and use it in GitHub Desktop.
#fizzbuzz
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 [n] | |
(let [fizzes (cycle ["" "" "Fizz"]) | |
buzzes (cycle ["" "" "" "" "Buzz"]) | |
pattern (map str fizzes buzzes) | |
numbers (map str (rest (range)))] | |
(take n (map #(some not-empty %&) pattern numbers)))) ;; another option would be `(partial max-key count)` | |
(run! println (fizzbuzz 100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment