Last active
August 29, 2015 14:08
-
-
Save zfogg/e12f4b02947af0a75047 to your computer and use it in GitHub Desktop.
overly-complex fizzbuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mergeWords = zipWith (\x -> (++) x . (++) " ") | |
fizzs = tail . repeat $ "Fizz" : replicate 4 "" | |
buzzs = tail . repeat $ "Buzz" : replicate 2 "" | |
fizzBuzzs = tail . repeat $ "FizzBuzz" : replicate 14 "" | |
numbers = map ((:[]) . show) [0..] | |
main = mapM_ putStrLn $ tail $ | |
map (last . words) . foldl1 mergeWords $ | |
map (concat . take 101) [numbers, fizzs, buzzs, fizzBuzzs] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment