Skip to content

Instantly share code, notes, and snippets.

@HybridEidolon
Last active August 29, 2015 14:21
Show Gist options
  • Save HybridEidolon/cab191e6c0ef9583ff30 to your computer and use it in GitHub Desktop.
Save HybridEidolon/cab191e6c0ef9583ff30 to your computer and use it in GitHub Desktop.
fizzbuzz is really not that hard, come on
fizzBuzz :: [[Char]]
fizzBuzz = map (mapFizzBuzz) [1..100]
mapFizzBuzz :: Int -> [Char]
mapFizzBuzz n
| (n `mod` 3 == 0) && (n `mod` 5 == 0) = "FizzBuzz"
| n `mod` 3 == 0 = "Fizz"
| n `mod` 5 == 0 = "Buzz"
| otherwise = show n
main = mapM_ (putStrLn . mapFizzBuzz) [1..100]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment