Skip to content

Instantly share code, notes, and snippets.

@Rembane
Created August 18, 2014 23:00
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 Rembane/2a8f104aaaa6afdadafa to your computer and use it in GitHub Desktop.
Save Rembane/2a8f104aaaa6afdadafa to your computer and use it in GitHub Desktop.
More Fizzbuzz!
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