Skip to content

Instantly share code, notes, and snippets.

@YusukeKokubo
Created April 19, 2012 08:46
Show Gist options
  • Save YusukeKokubo/2419750 to your computer and use it in GitHub Desktop.
Save YusukeKokubo/2419750 to your computer and use it in GitHub Desktop.
FizzBuzz by Haskell
fizzbuzz :: Int -> [String]
fizzbuzz n = map fb [1..n]
where fb x
| x `mod` 15 == 0 = "fizzbuzz"
| x `mod` 5 == 0 = "buzz"
| x `mod` 3 == 0 = "fizz"
| otherwise = show x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment