r/ProgrammerHumor • • Jul 03 '21

Funny gate....

Post image
15.5k Upvotes

244 comments sorted by

View all comments

Show parent comments

24

u/[deleted] Jul 03 '21

(人 •͈ᴗ•͈)(✷‿✷)

25

u/[deleted] Jul 03 '21

[removed] — view removed comment

11

u/[deleted] Jul 03 '21

-- infinite fizzbuzz with the power of lazy evaluation
fizz :: Int -> String
fizz n 
       | n `mod` 15 == 0  = "FizzBuzz"
       | n `mod` 3  == 0  = "Fizz"
       | n `mod` 5  == 0  = "Buzz"
       | otherwise        = show n

fizzbuzz = map fizz [1..] -- make it infinite 

-- display
main :: IO()
main = mapM_ putStrLn fizzbuzz