Created
February 4, 2013 11:26
-
-
Save janv/4706223 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
main = do sequence_ (map (putStr . (++ "\n")) (fizzbuzz 100)) | |
fizzbuzz upper = [stringify x | x <- [1..upper]] | |
where stringify n | |
| n `divisibleBy` 15 = "fizzbuzz" | |
| n `divisibleBy` 3 = "fizz" | |
| n `divisibleBy` 5 = "buzz" | |
| otherwise = show n | |
divisibleBy dividend divisor = dividend `mod` divisor == 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment