Skip to content

Instantly share code, notes, and snippets.

@mattfield
Forked from adtaylor/fizz_buzz.rb
Last active December 21, 2015 01:58
Show Gist options
  • Save mattfield/6231268 to your computer and use it in GitHub Desktop.
Save mattfield/6231268 to your computer and use it in GitHub Desktop.
module Main where
import Data.Monoid (mappend)
import Data.Maybe (fromMaybe, listToMaybe, maybe)
import System.Environment (getArgs)
fizzbuzz i = fromMaybe (show i) $ mappend ["fizz" | i `rem` 3 == 0]
["buzz" | i `rem` 5 == 0]
main = mapM_ putStrLn [ fizzbuzz i | i <- [1..100] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment