Hacker News new | past | comments | ask | show | jobs | submit login

> Because nobody ever makes typos while using folds and closures, right?

If you type flod instead of fold, the compiler will complain. If you have an off-by-one error in your for loop, not so much.




If you type foldr instead of foldl it won't complain.


In most cases it will because they have different types:

    foldl :: (a -> b -> a) -> a -> [b] -> a
    foldr :: (a -> b -> b) -> b -> [a] -> b
So the only time it will be the same is if a and b are the same type.


> So the only time it will be the same is if a and b are the same type.

Which they will be in most of the example code he used. They're not the best examples.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: