On Wed, Oct 10, 2001 at 01:27:35PM -0700, Colin Meyer wrote:
> On Wed, Oct 10, 2001 at 09:42:58PM +1000, Damian Conway wrote:
> >  
> >  John observed:
> > 
> >    > I just read Apocalypse and Exegesis 3, and something stuck out at me
> >    > because of its omission, namely using hyper operators for reduction.
> >    > 
> >    > $a ^+= @list;  # should sum the elements of @list
> 
> Does this mean that 
> 
> @a ^+= @b;
> 
> will add every value of @b to every value of @a?

Yes, that's correct.

Thinking about this, I'm realizing that there's something missing
in map.... I was trying to think of how this mapped to map's syntax,
and the problem is indexes. It would be very nice if there were some
temporary variable that could be accessed from map that contained
the index.

This is what I mean:

        @a = map {$_ + $b[$map_index]} @a;

which is almost the same thing as the previous statement, except for the
behavior on a short @a.

I'm wondering about some other operators.... Will there be a ^?? operator?

I might, for example, say:

        @a = @b ^?? 'yea' :: 'nay';

Which I would expect to be the same as:

        @a = map {$_ ?? 'yea' :: 'nay'} @b;

Will unary operators have hyper-equivalents, as well? Will,

        @a = ^-@b;

work?

-- 
Aaron Sherman
[EMAIL PROTECTED]             finger [EMAIL PROTECTED] for GPG info. Fingerprint:
www.ajs.com/~ajs        6DC1 F67A B9FB 2FBA D04C  619E FC35 5713 2676 CEAF
  "Write your letters in the sand for the day I'll take your hand
   In the land that our grandchildren knew." -Queen/_'39_

Reply via email to