Skip to content

Instantly share code, notes, and snippets.

@effectfully
Created September 10, 2019 08:54
Show Gist options
  • Save effectfully/de9709d4b6b38a5d607e88cc4629609e to your computer and use it in GitHub Desktop.
Save effectfully/de9709d4b6b38a5d607e88cc4629609e to your computer and use it in GitHub Desktop.
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