On Mon Oct 10 16:25:45 2011, coke wrote:
> On Thu Sep 02 20:55:52 2010, masak wrote:
> > <Util> rakudo: my @a = 1, 2, 3; @a X*= 5; say @a.perl; @a = @a X* 5;
> > say @a.perl;
> > <p6eval> rakudo 33e94e: OUTPUT«[1, 2, 3]␤[5, 10, 15]␤»
> > <Util> Should X*= have worked? If not, how to best scale a vector
> > without repeating the vector's array name?
> > <masak> @b = @a X* 5
> > <masak> :P
> > <masak> and yes, I think X*= should have worked.
> > * masak submits rakudobug
> > <tylercurtis> rakudo: my @a = 1, 2, 3; @a [X*]= 5; say @a.perl; @a =
> > @a X* 5; say @a.perl;
> > <p6eval> rakudo 33e94e: OUTPUT«===SORRY!===␤Confused at line 22, near
> > "@a [X*]= 5"␤»
> > <Util> S03 discusses X[+=] vs [X+]= in "Nesting of metaoperators", but
> > X[*=] does the same as X*= , and [X*]= fails.
> > <Util> Oh, as tylercurtis just showed.
> 
> This now fails outright:
> 
> 19:25 < [Coke]> rakudo: my @a = 1, 2, 3; @a X*= 5; say @a.perl; @a = @a X* 
>                 5;say @a.perl;
> 19:25 <+p6eval> rakudo 38907e: OUTPUT«Array.new(1, 2, 3)␤splice() not 
>                 implemented in class 'Mu'␤  in method reify at 
>                 src/gen/CORE.setting:3657␤  in method gimme at 
>                 src/gen/CORE.setting:4015␤  in method eager at 
>                 src/gen/CORE.setting:3991␤  in method STORE at 
>                 src/gen/CORE.setting:4409␤  in block <anon> a…
> 

Output is now close to the OP:

> my @a = 1, 2, 3; @a X*= 5; say @a.perl; @a = @a X* 5;say @a.perl;
Array.new(1, 2, 3)
Array.new(5, 10, 15)


-- 
Will "Coke" Coleda

Reply via email to