Difference between revisions of "Haskell Quiz/FizzBuzz/Solution Heisenbug"

From HaskellWiki
Jump to: navigation, search
(Remove old, not very useful page)
m (Reverted edits by Tomjaguarpaw (talk) to last revision by Heisenbug)
 
Line 1: Line 1:
  +
{-# 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])

Latest revision as of 15:18, 6 February 2021

 {-# 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])