Last active
August 29, 2015 14:21
-
-
Save bruno-cadorette/dd85bb4b8c886ca64d72 to your computer and use it in GitHub Desktop.
fizzbuzz with infinite list, without modulo
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
| fizzbuzz xs = | |
| let | |
| fizz = cycle ["","","fizz"] | |
| buzz = cycle ["","","","","buzz"] | |
| f x i = if null x then show i else x | |
| in | |
| zipWith3 (\fz bz i-> f (fz++bz) i) fizz buzz xs | |
| main = do | |
| putStr $ unlines $ fizzbuzz [1..100] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment