Skip to content

Instantly share code, notes, and snippets.

@maemre
Last active December 21, 2015 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maemre/6229804 to your computer and use it in GitHub Desktop.
Save maemre/6229804 to your computer and use it in GitHub Desktop.
A solution to infamous FizzBuzz test in Haskell
module Main where
fb x
| x `divp` (3*5) = "FizzBuzz"
| x `divp` 3 = "Fizz"
| x `divp` 5 = "Buzz"
| otherwise = show x
where divp x y = (mod x y == 0)
main =
mapM (putStrLn . fb) [1..100]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment