
17 Jul
2008
17 Jul
'08
3:09 p.m.
Marco Túlio Gontijo e Silva wrote:
Hi.
Em Qui, 2008-07-17 às 11:42 -0300, Felipe Lessa escreveu:
f = sum &&& foldr max 0 >>> uncurry (-)
You can replace
foldr max 0 with simply foldr1 max or even maximum
If it's important that the function return 0 when given an empty list, then you don't want to use foldr1 or maximum. But, if you don't need it to, then it may be sounder to have it fail on an empty list, because it's not particularly well-defined what it should return then. -Isaac