Skip to content

Instantly share code, notes, and snippets.

@MachinesAreUs
Created March 13, 2012 17:00
Show Gist options
  • Save MachinesAreUs/2029919 to your computer and use it in GitHub Desktop.
Save MachinesAreUs/2029919 to your computer and use it in GitHub Desktop.
FizzBuzz en haskell
fizzbuzz x
| x `mod` 3 == 0 && x `mod` 5 == 0 = "fizzbuzz"
| x `mod` 3 == 0 = "fizz"
| x `mod` 5 == 0 = "buzz"
| otherwise = show x
fizzbuzz100 =
mapM_ putStrLn [ fizzbuzz x | x <- [1..100] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment