Skip to content

Instantly share code, notes, and snippets.

@bodhi
Created October 13, 2014 23:45
Show Gist options
  • Save bodhi/4dce5682aa7da305e651 to your computer and use it in GitHub Desktop.
Save bodhi/4dce5682aa7da305e651 to your computer and use it in GitHub Desktop.
Dumb implementation of FizzBuzz
fizz = cycle [[], [], "fizz"]
buzz = cycle [[], [], [], [], "buzz"]
numbers = [1..]
fizzbuzz = zip3 fizz buzz numbers
toFizzBuzz [] [] x = show x
toFizzBuzz fizz buzz x = fizz ++ buzz
printTuple :: ([Char],[Char],Integer) -> IO ()
printTuple (x,y,z) = print $ toFizzBuzz x y z
main = mapM_ printTuple $ take 100 fizzbuzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment