Skip to content

Instantly share code, notes, and snippets.

@sneeu
Created August 13, 2012 11:08
Show Gist options
  • Save sneeu/3339572 to your computer and use it in GitHub Desktop.
Save sneeu/3339572 to your computer and use it in GitHub Desktop.
fizzBuzz :: Int -> (Int, String)
fizzBuzz a
| a `mod` 15 == 0 = (a, "FizzBuzz")
| a `mod` 3 == 0 = (a, "Fizz")
| a `mod` 5 == 0 = (a, "Buzz")
| otherwise = (a, "")
fizzBuzz' :: [Int] -> [(Int, String)]
fizzBuzz' [] = []
fizzBuzz' [x] = [fizzBuzz(x)]
fizzBuzz' (x:xs) = [fizzBuzz(x)] ++ fizzBuzz'(xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment