Re: Apocalypse 3
Damian Conway <[EMAIL PROTECTED]> writes: > @a =^+ 1; # evaluate each element of the list (1) in a numeric > # context and assign the resulting list to @a > # i.e. @a = $_ foreach +1; > > @a ^=+ 1; # evaluate 1 in a numeric context and assign it to > # each existing element of @a > # i.e. $_ = +1 foreach @a; > > @a ^+= 1; # add-assign 1 to each element of @a > # i.e. $_ += 1 foreach @a; Perl 6 is actually APL in drag. * _Dave quad backspace divides furiously. So, let's say we can use alternate character sets in perl6 AND we can pretty much overload all the operators AND create new ones on the fly AND all the matrix libraries are there THEN we can code APL in perl. -- David Hodgkinson, Wizard for Hirehttp://www.davehodgkinson.com Editor-in-chief, The Highway Star http://www.deep-purple.com Interim Technical Director, Web Architecture Consultant for hire -- chmod a+x /bin/laden --
Re: Apocalypse 3
> >> @a =^+ 1; > > > > You *can*, but it's not the same as doing: > > > > @a ^=+ 1; > > > > or: > > > > @a ^+= 1; > > What does this last line do? ;-) "And for the viewers at home, the answers are... @a =^+ 1; # evaluate each element of the list (1) in a numeric # context and assign the resulting list to @a # i.e. @a = $_ foreach +1; @a ^=+ 1; # evaluate 1 in a numeric context and assign it to # each existing element of @a # i.e. $_ = +1 foreach @a; @a ^+= 1; # add-assign 1 to each element of @a # i.e. $_ += 1 foreach @a; Damian
Re: Apocalypse 3
* Damian Conway ([EMAIL PROTECTED]) wrote: >> I'm all hypered up. Does this mean that in Perl 6 I can do this: >> >> @a =^+ 1; > > You *can*, but it's not the same as doing: > > @a ^=+ 1; > > or: > > @a ^+= 1; > > %-) What does this last line do? ;-) -- Greg McCarroll http://217.34.97.146/~gem/
Re: Apocalypse 3
> I'm all hypered up. Does this mean that in Perl 6 I can do this: > > @a =^+ 1; You *can*, but it's not the same as doing: @a ^=+ 1; or: @a ^+= 1; %-) Damian
Re: Apocalypse 3
Quoting Merijn Broeren ([EMAIL PROTECTED]): > Quoting Leon Brocard ([EMAIL PROTECTED]): > > Find out some more about Perl 6: > > http://www.perl.com/pub/a/2001/10/02/apocalypse3.html > > > I'm all hypered up. Does this mean that in Perl 6 I can do this: > > @a =^+ 1; > > ? I think I need a tranc now. > Ah, and I propose we call this one : @foo ^=~ s/foo/bar/; the 'dragon' operator. [1] ;-) [1] I know, I know, it's not an operator. Sosumi. -- Merijn Broeren | "No, I don't want to be an ambassador in the country called Software Geek | after your name. I just want to be a conqueror of that | country and merciless occupier...!"
Re: Apocalypse 3
Quoting Leon Brocard ([EMAIL PROTECTED]): > Find out some more about Perl 6: > http://www.perl.com/pub/a/2001/10/02/apocalypse3.html > I'm all hypered up. Does this mean that in Perl 6 I can do this: @a =^+ 1; ? I think I need a tranc now. Cheers, -- Merijn Broeren | Software Geek | Yield to temptation; it may not pass your way again. |