Skip to content

Instantly share code, notes, and snippets.

@masaedw
Forked from yuya-takeyama/fizzbuzz.hs
Created October 9, 2011 09:47
Show Gist options
  • Save masaedw/1273509 to your computer and use it in GitHub Desktop.
Save masaedw/1273509 to your computer and use it in GitHub Desktop.
FizzBuzz in Haskell.
fizzbuzzList = [x | x <- map fizzbuzz [1..]]
where fizzbuzz x | x `mod` 15 == 0 = "FizzBuzz"
| x `mod` 5 == 0 = "Buzz"
| x `mod` 3 == 0 = "Fizz"
| otherwise = show x
main = do
mapM_ putStrLn $ take 100 $ fizzbuzzList
@masaedw
Copy link
Author

masaedw commented Oct 9, 2011

無限リストにしてみた

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment