Created
March 8, 2015 08:14
-
-
Save TGOlson/c770f10fc9f07cae1fb2 to your computer and use it in GitHub Desktop.
Haskell FizzBuzz Kata
This file contains hidden or 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
| getFizzBuzz :: (Int, Int, Int) -> String | |
| getFizzBuzz (_, 0, 0) = "FizzBuzz" | |
| getFizzBuzz (_, 0, _) = "Fizz" | |
| getFizzBuzz (_, _, 0) = "Buzz" | |
| getFizzBuzz (x, _, _) = show x | |
| fizzBuzz :: Int -> [String] | |
| fizzBuzz n = [getFizzBuzz (x, x `mod` 3, x `mod` 5) | x <- [1..n]] | |
| fizzBuzz 15 | |
| ["1","2","Fizz","4","Buzz","Fizz","7","8","Fizz","Buzz","11","Fizz","13","14","FizzBuzz"] |
mijinrocks
commented
Mar 9, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment