by zeeone on 8/11/11, 12:29 AM with 3 comments
by jerf on 8/11/11, 1:14 AM
# reducing; folding is obvious from here
my $accum = 0;
map { $accum += $_ } @nums;
# filter
map { $_ ? ($_) : () } @list;
# also grep, of course, but if you want to filter and
# do other things it's useful
# flattening
map { @$_ } @arrayrefs;
For the rest, just look at the source code and observe, for instance, the pointless wrapping of List::Utils::uniq for unique. Far more idiomatic or established ways of doing all (or almost all, with the remainder being easily fixed up from CPAN) these things exist in the core shipped modules. The actual use of this library is almost certain to be both klunkier and less idiomatic and readable than what Perl ships with out of the box.Underscore is not the sine qua non of weak functional programming.