Skip to content

Instantly share code, notes, and snippets.

@hajimehoshi
Created October 9, 2011 04:48
Show Gist options
  • Save hajimehoshi/1273314 to your computer and use it in GitHub Desktop.
Save hajimehoshi/1273314 to your computer and use it in GitHub Desktop.
FizzBuzz in Haskell
main :: IO ()
main = print $ map fizzBuzz [1..]
fizzBuzz :: Integer -> String
fizzBuzz n
| n `rem` 15 == 0 = "FizzBuzz"
| n `rem` 3 == 0 = "Fizz"
| n `rem` 5 == 0 = "Buzz"
| otherwise = show n
@dekosuke
Copy link

Please make shorter one.

@hajimehoshi
Copy link
Author

Haskell はゴルフ向きじゃないだろー

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment