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

    import Data.List (intercalate)

    fizzle :: Int -> String
    fizzle n =
        let ws = [(3,"Fizz"), (5,"Buzz"), (7,"Bazz")]
            a = [s | (d,s) <- ws, n`rem`d == 0]
        in case a of []        -> show n
                     otherwise -> intercalate " " a ++ "!"

    main = mapM_ (putStrLn . fizzle) [1..110]


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: