Skip to content

Instantly share code, notes, and snippets.

@niku
Created June 27, 2012 16:37
Show Gist options
  • Save niku/3005277 to your computer and use it in GitHub Desktop.
Save niku/3005277 to your computer and use it in GitHub Desktop.
はじめてのHaskellプログラム - FizzBuzz
fizzBuzz :: Int -> String
fizzBuzz n
| isFizzBuzz n = "FizzBuzz"
| isFizz n = "Fizz"
| isBuzz n = "Buzz"
| otherwise = show n
where isFizz n = (n `mod` 3 == 0)
isBuzz n = (n `mod` 5 == 0)
isFizzBuzz n = isFizz n && isBuzz n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment