Last active
December 20, 2015 10:39
-
-
Save alf239/6117025 to your computer and use it in GitHub Desktop.
Fizz/Buzz
This file contains 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 characters
import Data.List | |
fizzbuzz :: Int -> String | |
fizzbuzz i | |
| divisibleBy 15 = "FizzBuzz" | |
| divisibleBy 5 = "Buzz" | |
| divisibleBy 3 = "Fizz" | |
| otherwise = show i | |
where divisibleBy = (==) 0 . mod i | |
solution = unwords $ map fizzbuzz [1..100] | |
main :: IO () | |
main = putStrLn solution |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment