develooper Front page | perl.perl6.language | Postings from May 2005

Re: reduce metaoperator

Thread Previous | Thread Next
From:
Aaron Sherman
Date:
May 4, 2005 06:34
Subject:
Re: reduce metaoperator
Message ID:
1115213668.9630.16666.camel@pps
On Wed, 2005-05-04 at 09:06, Larry Wall wrote:
> On Wed, May 04, 2005 at 09:00:46AM -0400, Aaron Sherman wrote:
> : That said, let me try to be helpful, and not just complain:
> : 
> : 	$sum = (+) @array;

> It's certainly one of the ones I considered, along with all the other
> brackets, and |+|, plus variants  

I could see [], but the others don't have any mnemonic for
list-opification.

Hmmm...

	$sum = [+] @array

Nice.

> It just seemed like it'd be a little
> visually confusing where you want to turn the list op into a function
> 
>     $sum = (+)(@array);

	$sum = [+](1,2,3);

Not bad, not bad.

> But maybe that's not a problem.  But there are other potential
> ambiguities besides visual, I suspect.

Juerd mentioned x, which is certainly one such. Any \w+ keyword is going
to be a problem, but I think you can make the case for any:

	sub infix:foo($a,$b){...}

enforcing correct handling of:

	sub list:[foo](*@list) {...}

Oh hey, I just made up "list:..." There's nothing for that listed in
A12, and that handy table from A12 doesn't show up in S12 or S13... is
that an oversight? Have new categories been added?

-- 
Aaron Sherman <ajs@ajs.com>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About