Haskell Quiz/FizzBuzz/Solution Heisenbug

From HaskellWiki
< Haskell Quiz‎ | FizzBuzz
Revision as of 17:48, 31 July 2017 by Heisenbug (talk | contribs) (fun exercise)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

{-# LANGUAGE LambdaCase #-}

main = mapM_ (putStrLn . fizzbuzz) [1 .. 100]

 where fizzbuzz n = (\case "" -> show n; fb -> fb)
                      (concat $ ["fizz" | n `rem` 3 == 0] <> ["buzz" | n `rem` 5 == 0])