Quite similarly, for example, I'd like to have a fold() function like the one that is available in many functional programming languages, a la:
my $tot = fold 0, { + }, 1..10; # 55 my $fact = fold 1, { * }, 2..5; # 120
Those blocks would be a syntax error; the appropriate way to do that would be to refer to the operator by its proper name:
my $tot = fold 0, &infix:+, 1..10;
OTOH, Perl 5 already has List::Util::reduce:
use List::Util; my $tot=reduce { $a + $b } 1..10; my $fact=reduce { $a * $b } 2..5;
Your fold() can be trivially expressed with reduce(), IIUC. I would hope that Perl 6 will have reduce() as well--perhaps even in a form that doesn't require using List::Util explicitly.
-- Brent "Dax" Royal-Gordon <[EMAIL PROTECTED]> Perl and Parrot hacker
Oceania has always been at war with Eastasia.