3 ms·
fizzBuzz x = if null str then show x else str where str = concat [tag | (n,tag) <- tags, x `rem` n == 0] tags = [(3,"Fizz"), (5,"Buzz")] main
by rollo 13y ago
fizzBuzz x = if null str then show x else str
where str = concat [tag | (n,tag) <- tags, x `rem` n == 0]
tags = [(3,"Fizz"), (5,"Buzz")]
main = mapM_ (putStrLn . fizzBuzz) [1..100]
Extendable.
- gamegoblin 13y agorem is identical to modulus for positive numbers.