Created
February 4, 2017 15:50
-
-
Save P7h/1a79b21aa1a9a1b17701b99c53b51c84 to your computer and use it in GitHub Desktop.
Revisions
-
P7h created this gist
Feb 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ -- FizzBuzz in Haskell fizzbuzz :: Int -> String fizzbuzz n = if fb /= "" then fb else show n where fb = fizz n ++ buzz n fizz:: Int -> String fizz n | n `mod` 3 == 0 = "Fizz" | otherwise = "" buzz:: Int -> String buzz n | n `mod` 5 == 0 = "Buzz" | otherwise = "" main = do mapM_ (putStrLn) [fizzbuzz x | x <- [1..100]] -- ghc fizzbuzz.hs -- fizzbuzz.exe