Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 415 Bytes

different-implementations-of-fizzbuzz-in-haskell.md

File metadata and controls

17 lines (14 loc) · 415 Bytes

Different Implementations of Fizzbuzz in Lisp

module Main where
main :: IO ()
main = printAll $ map fizzBuzz [1..100]
     where
     printAll [] = return ()
     printAll (x:xs) = putStrLn x >> printAll xs

fizzBuzz :: Integer -> String
fizzBuzz n | n `mod` 15 == 0 = "FizzBuzz"
           | n `mod` 5  == 0 = "Fizz"
           | n `mod` 3  == 0 = "Buzz"
           | otherwise       = show n