Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

fizzbuzz.hs

Name: Anonymous 2012-09-24 0:24

module Main where

main :: IO ()
main = do putStrLn "FizzBuzz Upto: "
      n <- getLine
      printAll $ map fizzbuzz [1..(read n :: Int)]
      where
      printAll [] = getLine >> return ()
      printAll (x:xs) = putStrLn x >> printAll xs
      fizzbuzz n
        | mod n 15 == 0 = "FizzBuzz"
        | mod n 5  == 0 = "Buzz"
        | mod n 3  == 0 = "Fizz"
        | otherwise    = show n

Name: You're obviously a 2012-09-24 1:10

Simply disgusting.

Name: Anonymous 2012-09-24 1:16

Once again proving that C can do everything more elegantly and efficient than every other language.

Name: Anonymous 2012-09-24 1:46

>>3
Partial credit.

Name: Anonymous 2012-09-24 2:31

main = putStr "FizzBuzz Upto: " >> getLine >>= mapM_ (putStrLn . fizzbuzz) . enumFromTo 1 . read
  where
    fizzbuzz n
      | mod n 15 == 0 = "FizzBuzz"
      | mod n  5 == 0 = "Buzz"
      | mod n  3 == 0 = "Fizz"
      | otherwise     = show n

Name: Anonymous 2012-09-24 3:35

>>5
mapM_ is ugly.

main = putStr "FizzBuzz Upto: " >> getLine >>= putStr . (>>= fizzbuzz) . enumFromTo 1 . read
  where
    fizzbuzz n
      | mod n 15 == 0 = "FizzBuzz\n"
      | mod n  5 == 0 = "Buzz\n"
      | mod n  3 == 0 = "Fizz\n"
      | otherwise     = shows n "\n"

Name: Anonymous 2012-09-24 3:48

where fizzbuzz such that the gallery programmers are swining on the clotheslines like the bunch of naked lunatics they are

Name: Anonymous 2012-09-24 5:33

I'd learn Haskell but the disk space GHC would've taken up I've already given to L^aT_eX. As much as I have free, I just don't want to use all my bandwidth on system updates.

Name: Anonymous 2012-09-24 9:35

>>8

It's \LaTeX{}

Don't change these.
Name: Email:
Entire Thread Thread List