Skip to content

Instantly share code, notes, and snippets.

@alf239
Last active December 20, 2015 10:39
Show Gist options
  • Save alf239/6117025 to your computer and use it in GitHub Desktop.
Save alf239/6117025 to your computer and use it in GitHub Desktop.
Fizz/Buzz
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