Last active
August 29, 2015 13:56
-
-
Save ramirez7/8921289 to your computer and use it in GitHub Desktop.
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
| fizzCases = [(3, "Fizz"), (5, "Buzz"), (7, "Baz")] | |
| fizzBuzz :: Int -> String | |
| fizzBuzz n = case (foldl fizzBuzzify "" fizzCases) of | |
| "" -> show n | |
| s -> s | |
| where | |
| fizzBuzzify acc (i, s) = if ((n `mod` i) == 0) then acc ++ s else acc | |
| -- map fizzBuzz [1..100] will do the correct behavior |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment