logoalt Hacker News

JadeNB12/09/20241 replyview on HN

> The question becomes why all_of returns true for an empty list.

Because it is, if you'll forgive my Haskell-ese, the only implementation that means that `all_of $ l1 ++ l2 == (all_of l1) && (all_of l2)` for all lists `l1` and `l2`, including empty ones.


Replies

gpderetta12/09/2024

yes of course, I was trying (and failed?) to draw a connection from all_of to accumulate (i.e. fold).

show 1 reply