Skip to content

Instantly share code, notes, and snippets.

@mbloms
Last active October 30, 2018 23:24
Show Gist options
  • Save mbloms/f79634491c770f2cef837b041199616a to your computer and use it in GitHub Desktop.
Save mbloms/f79634491c770f2cef837b041199616a to your computer and use it in GitHub Desktop.
import Data.List (cycle, zipWith3)
fizz = cycle $ [False,False,True]
buzz = cycle $ [False,False,False,False,True]
fizzbuzz False False i = show i
fizzbuzz True False _ = "Fizz"
fizzbuzz False True _ = "Buzz"
fizzbuzz True True _ = "FizzBuzz"
main = mapM_ putStrLn $ zipWith3 fizzbuzz fizz buzz [1..]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment