Last active
August 17, 2019 06:51
-
-
Save philipschwarz/4f5dae9e73c6d4c2d9b4ddfd8f9a0bbf to your computer and use it in GitHub Desktop.
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From Carlo Pescio's https://drive.google.com/file/d/0B59Tysg-nEQZOGhsU0U5QXo0Sjg/view?pref=2&pli=1