Don't get me wrong. I don't consider undef to be the same as zero (eventhough it could be treated as such in a numeric context) nor do i wish to see the behaviour of List::Util::sum() changed, I'm fine with it the way it is., infact I like it the way it is and don't want to see it changed.

I'm just questioning whether sum() was initially relased the way it is after all the possible exceptions were examined. Did Graham Barr initially oversee the empty list exception? If not why? If not why wasn't it fixed? I cannot definitely state whether the current behaviour is intended or not, I don't think anyone can, except Graham Barr himself. And if Graham decided to keep sum() the way it is, does he consider the sum of an empty list to be 0 or undef??


perl -e '$,=$",$_=(split/\W/,$^X)[y[eval]]]+--$_],print+just,another,split,hack'er

In reply to Re^11: List::Util::sum() and empty lists... (obvious) by Firefly258
in thread List::Util::sum() and empty lists... by blazar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.