Created
September 10, 2019 08:54
-
-
Save effectfully/de9709d4b6b38a5d607e88cc4629609e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fizzBuzz :: [String] | |
fizzBuzz | |
= take 100 | |
. zipWith (\i -> fromMaybe (show i) . fold) [1 :: Integer ..] | |
. transpose | |
. map (\(skip, word) -> cycle $ replicate skip Nothing ++ [Just word]) | |
$ rules | |
where | |
every n word = (n - 1, word) | |
rules = | |
[ every 3 "Fizz" | |
, every 5 "Buzz" | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment