Created
August 18, 2014 23:00
-
-
Save Rembane/2a8f104aaaa6afdadafa to your computer and use it in GitHub Desktop.
More Fizzbuzz!
This file contains hidden or 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
import Data.Maybe | |
mrd n x | mod n x == 0 = Just n | |
| otherwise = Nothing | |
lp = map (\n -> head . catMaybes $ zipWith (\f v -> v >> return f) ["FizzBuzz", "Fizz", "Buzz", show n] (map (mrd n) [15, 3, 5, 1])) [1..] | |
main :: IO () | |
main = putStr $ unlines $ take 100 lp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment