Last active
August 29, 2015 14:01
Fizz Buzz in Haskell
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
-- Feels like there's a shorthand for the duplicated `mod` expressions. | |
fizzBuzz x | |
| (x `mod` 3) == 0 && (x `mod` 5) == 0 = "FizzBuzz" | |
| (x `mod` 3) == 0 = "Fizz" | |
| (x `mod` 5) == 0 = "Buzz" | |
| otherwise = show x | |
-- Extracting the mod expressions in any way I know how (so far) leads to more complication. |
I think this is about as good as mine's going to get: https://gist.github.com/jbrains/2a29465457bddcca0c45
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Guard Clauses depend on sequence. Always has been; always will be.