Created
February 26, 2015 00:41
-
-
Save jamesdavidson/c24b6e97f4f0cad593a2 to your computer and use it in GitHub Desktop.
FizzBuzz in Haskell
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
main = mapM_ putStrLn $ take 25 fizzbuzz | |
fizzbuzz = map (\(f,b) -> f ++ b) $ zip fizzes buzzes | |
fizzes = map (moddy "fizz" 3) [1..] | |
buzzes = map (moddy "buzz" 5) [1..] | |
moddy str b i = if i `mod` b == 0 then str else "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment