Created
October 5, 2012 00:56
-
-
Save oconnor663/3837428 to your computer and use it in GitHub Desktop.
FizzBuzz.hs
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
pairs = [(3, "Fizz"), (5, "Buzz")] | |
main = mapM_ (putStrLn . fizzLine) [0..100] | |
where fizzLine x = if output /= "" then output else show x | |
where output = concat (map snd matches) | |
matches = filter (\pair -> x `rem` fst pair == 0) pairs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment