in reply to Re^2: More functional programming utilities
in thread More functional programming utilities

Within List::Util source, sum is defined:
sub sum (@) { reduce { $a + $b } @_ }
Where is the code you quoted from?

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^4: More functional programming utilities
by kaif (Friar) on Jun 08, 2005 at 16:22 UTC

    You're right, but above that code, there's a notice saying

    # This code is only compiled if the XS did not load

    My code is from the XS. I can't seem to link to it online, but the filename should be Util.xs, I think.

    Update: Here's a link from CPAN: Util.xs

      One minor trap with the XS equivelents in Util.xs is that they don't necessarily respect "magic". So for instance if your data is tied, or whatnot you'll find that the XS routines don't play nicely. The perl implementations on the other hand do not suffer this problem.

      ---
      $world=~s/war/peace/g

        Does Perl know this? That is, will it call the XS code for normal arrays and the Perl code for tied arrays?