Skip to content

Instantly share code, notes, and snippets.

@MihailJP
Created September 14, 2012 16:44
Show Gist options
  • Save MihailJP/3723163 to your computer and use it in GitHub Desktop.
Save MihailJP/3723163 to your computer and use it in GitHub Desktop.
Fizz Buzz in Haskell
fizzbuzz = [f n | n <- [1..]]
where
f x
| x `mod` 15 == 0 = "Fizz Buzz"
| x `mod` 5 == 0 = "Buzz"
| x `mod` 3 == 0 = "Fizz"
| otherwise = show (fromIntegral x)
main = do print (take 60 fizzbuzz)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment