On Mon Nov 05 13:54:40 2012, jn...@jnthn.net wrote:
> On Mon Nov 05 06:04:33 2012, masak wrote:
> > <brrt> basically, 'take' both yields its value and returns, right?
> > <brrt> so my $x = take 3; sets $x to 3?
> > <brrt> r: my $x = take 3; say $x;
> > <masak> r: my @a = gather { say take 3 };
> > <p6eval> rakudo 64208d: OUTPUT«0␤»
> > <masak> brrt: that's interesting.
> > <masak> what does the 0 mean?
> > <masak> r: my @a = gather { say take 3; say take 42 };
> > <p6eval> rakudo 64208d: OUTPUT«0␤0␤»
> > <masak> n: my @ = gather { say take 3; say take 42 };
> > <p6eval> niecza v22-16-g4c016f5: OUTPUT«3␤42␤»
> > * masak submits rakudobug
> > <flussence> take returns 0?
> > <flussence> (sometimes?)
> > <masak> flussence: in Rakudo, yes. in Niecza it gives back the value.
> > <masak> which seems much more useful.
> > <flussence> agreed
> > <brrt> masak: returning the value is basically what is spec'-ed
> > <masak> S04:735.
> > <masak> The value returned by the C<take> to the C<take>'s own context
> > is that same
> > <masak> returned argument (which is ignored when the C<take> is in
> > sink context).
> 
> Fixed:
> 
> > my @a = gather { my $x = take 3; say $x; }
> 3
> 
> Tagging testneeded.
> 
> /jnthn

Test added in S04-statements/gather.t

-- 
Will "Coke" Coleda

Reply via email to