Skip to content

Instantly share code, notes, and snippets.

@dannycjones
Created October 25, 2016 13:05
Show Gist options
  • Save dannycjones/aef3cae8c3aa5128142117fda2319f39 to your computer and use it in GitHub Desktop.
Save dannycjones/aef3cae8c3aa5128142117fda2319f39 to your computer and use it in GitHub Desktop.
fizzBuzz :: [Int] -> [String]
fizzBuzz listOfNumbers = [fizzify x | x <- listOfNumbers]
where
fizzify :: Int -> String
fizzify num
| fizz && buzz = "FizzBuzz"
| fizz = "Fizz"
| buzz = "Buzz"
| otherwise = show num
where fizz = num `mod` 3 == 0
buzz = num `mod` 5 == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment