Skip to content

Instantly share code, notes, and snippets.

@jamesdavidson
Created February 26, 2015 00:41
Show Gist options
  • Save jamesdavidson/c24b6e97f4f0cad593a2 to your computer and use it in GitHub Desktop.
Save jamesdavidson/c24b6e97f4f0cad593a2 to your computer and use it in GitHub Desktop.
FizzBuzz in Haskell
main = mapM_ putStrLn $ take 25 fizzbuzz
fizzbuzz = map (\(f,b) -> f ++ b) $ zip fizzes buzzes
fizzes = map (moddy "fizz" 3) [1..]
buzzes = map (moddy "buzz" 5) [1..]
moddy str b i = if i `mod` b == 0 then str else ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment