A. Pagaltzis skribis 2006-06-18 10:28 (+0200):
> $foo, $bar, ( $wibble ? $baz : () ), $quux
> Is there a construct in Perl 6 to express this more immediately?
> Something along the lines of the following would seem ideal:
> $foo, $bar, ( $baz if $wibble ), $quux
pugs> my @foo = 1, 2, 3, { 4 if 0 }.(), 5; say @foo.perl
[1, 2, 3, 5]
bool::true
pugs> my @foo = 1, 2, 3, { 4 if 1 }.(), 5; say @foo.perl
[1, 2, 3, 4, 5]
bool::true
Though I have no idea if this is intended behaviour. It differs from
Perl 5, and I couldn't find any spec detailing the change.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html