Skip to content

Instantly share code, notes, and snippets.

@andrewhavck
Created May 27, 2010 19:07
Show Gist options
  • Save andrewhavck/416209 to your computer and use it in GitHub Desktop.
Save andrewhavck/416209 to your computer and use it in GitHub Desktop.
interpret = fizzbuzz [1..100]
fizzbuzz [] = []
fizzbuzz (x:xs) = checknum(x) ++ fizzbuzz(xs)
checknum x | both x = "FizzBuzz"
| three x = "Fizz"
| five x = "Buzz"
| otherwise = show x
where both x = three x && five x
three x = (x `mod` 3) == 0
five x = (x `mod` 5) == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment