Re: Conditionally included list elements

2006-06-18 Thread A. Pagaltzis
* Larry Wall <[EMAIL PROTECTED]> [2006-06-18 19:40]: > On Sun, Jun 18, 2006 at 07:27:57PM +0200, A. Pagaltzis wrote: >>* Larry Wall <[EMAIL PROTECTED]> [2006-06-18 19:05]: >>> We already have the operator you want. It's spelled C. >>> :-) >> >> Nice. :-) How’s it used? S03 doesn’t list it. > > N

Re: Conditionally included list elements

2006-06-18 Thread Larry Wall
On Sun, Jun 18, 2006 at 07:27:57PM +0200, A. Pagaltzis wrote: : * Larry Wall <[EMAIL PROTECTED]> [2006-06-18 19:05]: : > On Sun, Jun 18, 2006 at 05:18:52PM +0200, A. Pagaltzis wrote: : > : Maybe TheLarry can enlighten us… :-) : > : > We already have the operator you want. It's spelled C. :-) : :

Re: Conditionally included list elements

2006-06-18 Thread A. Pagaltzis
* Larry Wall <[EMAIL PROTECTED]> [2006-06-18 19:05]: > On Sun, Jun 18, 2006 at 05:18:52PM +0200, A. Pagaltzis wrote: > : Maybe TheLarry can enlighten us… :-) > > We already have the operator you want. It's spelled C. :-) Nice. :-) How’s it used? S03 doesn’t list it. Regards, -- #Aristotle *AUT

Re: Conditionally included list elements

2006-06-18 Thread Larry Wall
On Sun, Jun 18, 2006 at 05:18:52PM +0200, A. Pagaltzis wrote: : Maybe TheLarry can enlighten us… :-) We already have the operator you want. It's spelled C. :-) Larry

Re: Conditionally included list elements

2006-06-18 Thread Gaal Yahas
On Sun, Jun 18, 2006 at 05:18:14PM +0200, A. Pagaltzis wrote: > > pugs> sub infix:($x, $cond) { $cond ?? ($x,) !! () }; say 1, 2, (3 pv > > 1), 4 > > However, what are the evaluation semantics here? Neither the > ternary nor the `if`-based solutions evaluate the expression they > return if the c

Re: Conditionally included list elements

2006-06-18 Thread A. Pagaltzis
* Juerd <[EMAIL PROTECTED]> [2006-06-18 15:10]: > Again I have no idea if this empty list is SUPPOSED to happen. Maybe TheLarry can enlighten us… :-) Regards, -- Aristotle Pagaltzis //

Re: Conditionally included list elements

2006-06-18 Thread A. Pagaltzis
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 ),

Re: Conditionally included list elements

2006-06-18 Thread Juerd
Stuart Cook skribis 2006-06-18 22:59 (+1000): > pugs> sub infix:($x, $cond) { $cond ?? ($x,) !! () }; say 1, 2, > (3 pv 1), 4 > 1234 > bool::true > pugs> sub infix:($x, $cond) { $cond ?? ($x,) !! () }; say 1, 2, > (3 pv 0), 4 > 124 > bool::true > I couldn't think of a good name for the new op

Re: Conditionally included list elements

2006-06-18 Thread Juerd
A. Pagaltzis skribis 2006-06-18 14:40 (+0200): > Does Perl 6 have `do BLOCK` like Perl 5? That would make it > $foo, $bar, do { $baz if $wibble }, $quux pugs> 1, 2, do { 3 if 0 }, 4 (1, 2, 4) pugs> 1, 2, do { 3 if 1 }, 4 (1, 2, 3, 4) Again I have no idea if this empty list is

Re: Conditionally included list elements

2006-06-18 Thread Stuart Cook
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:($x, $cond) { $cond ?? ($x,) !! () }; s

Re: Conditionally included list elements

2006-06-18 Thread A. Pagaltzis
* Juerd <[EMAIL PROTECTED]> [2006-06-18 14:10]: > 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 That’s “conceptually noisy” though… I don’t know

Re: Conditionally included list elements

2006-06-18 Thread Juerd
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