Simple FizzBuzz in Haskell
Posted on haskell, fizzbuzzYesterday I started reading about Haskell through Learn You a Haskell. I started playing around with Haskell when I changed my window manager to Xmonad. Currently reading on Syntax in Functions: Guards, guards!. I was able to come up with this FizzBuzz function that I've read in Coding Horror. fizzBuzz :: (Integral a) => a -> String fizzBuzz a | a `mod` 5 == 0 && a `mod` 3 == 0 = "FizzBuzz" | a `mod` 3 == 0 = "Fizz" | a `mod` 5 == 0 = "Buzz" | otherwise = show a Somehow cheated because I based it on this though I don't quite get that one yet. :D So for now I...