Skip to content

Instantly share code, notes, and snippets.

@philipschwarz
Last active August 17, 2019 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipschwarz/4f5dae9e73c6d4c2d9b4ddfd8f9a0bbf to your computer and use it in GitHub Desktop.
Save philipschwarz/4f5dae9e73c6d4c2d9b4ddfd8f9a0bbf to your computer and use it in GitHub Desktop.
fizzbuzz :: [String]
fizzbuzz =
let fizzes = cycle ["", "", "fizz"]
buzzes = cycle ["", "", "", "", "buzz"]
pattern = zipWith (++) fizzes buzzes
in zipWith combine pattern [1..] where
combine word number =
if null word then show number else word
@philipschwarz
Copy link
Author

philipschwarz commented Aug 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment