online advertising

Tuesday, June 2, 2015

Haskell 99 Problem 8


Please find the problem here.


Please see the solution as follow:

Intuitively, I think of fold in this case. Pictorially, it does look like folding, isn't it? Ironically, in fact, almost all previous problem could be coded using fold instead, but I didn't.

I personally feel like fold does reduce the number of characters sometimes, but it less readable. Reading code involve understanding, and understanding is a pretty personal thing. There might not be an objective measure of readability at all, so the main problem really is, to fold or not to fold?

No comments :

Post a Comment