Haskell Quiz/FizzBuzz/Solution Acontorer
< Haskell Quiz | FizzBuzz
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
-- This implementation is designed to demonstrate extensibility,
-- as the list of tags can be easily edited, loaded from a file, etc.
fizzBuzz i = if null desc then show i else desc where
desc = concat [label | (j,label) <- tags, 0 == rem i j]
tags = [ (3,"Fizz"), (5,"Buzz"), (7,"Baz") ]
main = mapM_ (putStrLn . fizzBuzz) [1..120]