Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are a surprising number of ways to generate the fizzbuzz sequence. I always liked this one:

  fizzbuzz n = case (n^4 `mod` 15) of
    1  -> show n
    6  -> "fizz"
    10 -> "buzz"
    0  -> "fizzbuzz"

  fb :: IO ()
  fb = print $ map fizzbuzz [1..30]


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: