Created
January 22, 2014 13:43
-
-
Save stuhacking/8558931 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
module Main where | |
-- Infinite fizzbuzz sequence. | |
fizzbuzz :: [String] | |
fizzbuzz = [convert x | x <- [1..]] | |
where | |
convert s | |
| s `mod` 15 == 0 = "FizzBuzz" | |
| s `mod` 5 == 0 = "Buzz" | |
| s `mod` 3 == 0 = "Fizz" | |
| otherwise = show s | |
main :: IO () | |
main = do | |
mapM_ putStrLn $ take 100 fizzbuzz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment