Last active
August 29, 2015 14:02
-
-
Save JIghtuse/5b847f180419ea01dcbf to your computer and use it in GitHub Desktop.
Haskell FizzBuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
fizzBuzz :: Int -> String | |
fizzBuzz n | |
| mod n 15 == 0 = "FizzBuzz" | |
| mod n 3 == 0 = "Fizz" | |
| mod n 5 == 0 = "Buzz" | |
| otherwise = show n | |
main = do | |
let myFizzBuzzes = map fizzBuzz [1 .. 100] | |
fbs <- readFile "FizzBuzzes.txt" | |
if read fbs == myFizzBuzzes | |
then putStrLn "Right." | |
else putStrLn "Not right." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment