in reply to An infix fix
I don't think they deserve to be added to the core. They might be a good addition to List::Util, though. Actually the one you call add() already is there. It's called sum() ;-)
use List::Util qw(reduce); sub reduce_c (&) { my $block = shift(); return sub {&reduce($block, @_ +)}} my $plus = reduce_c {$a+$b}; print $plus->(1,2,3,4,5), "\n"; *tajms = reduce_c {$a*$b}; print tajms(1,2,3,4,5), "\n";
Jenda
|
We'd like to help you learn to help yourself Look around you, all you see are sympathetic eyes Stroll around the grounds until you feel at home -- P. Simon in Mrs. Robinson |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: An infix fix
by Roy Johnson (Monsignor) on Mar 22, 2005 at 14:38 UTC |