Skip to content

Instantly share code, notes, and snippets.

@oconnor663
Created October 5, 2012 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oconnor663/3837428 to your computer and use it in GitHub Desktop.
Save oconnor663/3837428 to your computer and use it in GitHub Desktop.
FizzBuzz.hs
pairs = [(3, "Fizz"), (5, "Buzz")]
main = mapM_ (putStrLn . fizzLine) [0..100]
where fizzLine x = if output /= "" then output else show x
where output = concat (map snd matches)
matches = filter (\pair -> x `rem` fst pair == 0) pairs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment