I just wonder what Graham Barr (the original author) has to say about it?
Maybe he did it for consistency. Every function in the module returns undef when given an empty list (except shuffle, which doesn't return a scalar).
Maybe it didn't occur to him to check for that case, since sum is simply sub sum (@) { reduce { $a + $b } @_ }. (While the XS version explicitely returns undef, it probably came after the Perl version.)
In reply to Re^8: List::Util::sum() and empty lists... (obvious)
by ikegami
in thread List::Util::sum() and empty lists...
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |