Hi Stuart, * Stuart Cook <[EMAIL PROTECTED]> [2006-06-18 15:05]: > On 6/18/06, A. Pagaltzis <[EMAIL PROTECTED]> wrote: > >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 > > How about this: > > pugs> sub infix:<pv>($x, $cond) { $cond ?? ($x,) !! () }; say 1, 2, (3 pv > 1), 4 > 1234 > bool::true
Good point! I like. However, what are the evaluation semantics here? Neither the ternary nor the `if`-based solutions evaluate the expression they return if the condition turns out to be false. Wouldn’t your solution evaluate it unconditionally? Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>