Skip to content

Instantly share code, notes, and snippets.

@chancez
Created January 27, 2013 00:29
Show Gist options
  • Save chancez/4645494 to your computer and use it in GitHub Desktop.
Save chancez/4645494 to your computer and use it in GitHub Desktop.
isDivisible :: Int -> Int -> Bool
isDivisible x y = x `mod` y == 0
buzzer :: Int -> String
buzzer n
| n `isDivisible` 3 && n `isDivisible` 5 = "FizzBuzz"
| n `isDivisible` 3 = "Fizz"
| n `isDivisible` 5 = "Buzz"
| otherwise = show n
fizzbuzz :: [Int] -> [String]
fizzbuzz n = [buzzer x | x <- n]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment