Re: Paren madness (was Re: Regex query)

2002-10-01 Thread Thomas A. Boyer
David Whipp wrote: > $b = 7, 6, 5 > @b = 7, 6, 5 I understand that C's *interpretation* of the comma operator will be expunged from Perl 6. But unless comma's *precedence* is also changing, neither of those statements would build a list with three elements. It seems to me that $b = 7, 6,

Re: Paren madness (was Re: Regex query)

2002-09-25 Thread Nicholas Clark
On Mon, Sep 23, 2002 at 11:54:06PM -0600, John Williams wrote: > After testing various cases of x, I came up with one that I cannot > explain. Can someone tell me what is happening here (in perl5)? > > $ perl -le 'print "@{[ $a = ('a','b') x 3 ]}"; print $a' > a bbb > bbb > > or in other words

Re: Paren madness (was Re: Regex query)

2002-09-25 Thread Aaron Sherman
On Tue, 2002-09-24 at 17:27, John Williams wrote: > If I understand our non-conclusions so far, we're waiting for Larry to > clarify: > > 1) how to create a 1-tuple/1-item list? > > 2) how to interpret the flattened list context? e.g. given this: > > > $x = (1,2,3); > > @y = (

Re: Paren madness (was Re: Regex query)

2002-09-24 Thread John Williams
On Tue, 24 Sep 2002, Mike Lambert wrote: > > > > $a = (1, 2, 3); # Same as Perl 5's $a = [1,2,3]; > > $a = (1) should then do $a = [1], according to the above. > > This implies that: > > ($a) = (1) implies that $a is [1], something I don't particularly agree > with. You may be missing the chang

RE: Paren madness (was Re: Regex query)

2002-09-24 Thread David Whipp
> From: Jonathan Scott Duff > > $b = 7, 6, 5 > > @b = 7, 6, 5 > > > > Again, both create identical objects, under different > > interfaces. But now we have a problem with +$b: what should > > this mean? To be consistant with +$a (above), I would > > suggest that it simply returns the sum of

Re: Paren madness (was Re: Regex query)

2002-09-24 Thread Trey Harris
In a message dated Tue, 24 Sep 2002, Mike Lambert writes: > Consider: > $a = (1); > and > ($a) = (1); Yes? They both do the same thing--set $a to 1. It looks like the bottom one is a list assigned to a list, but that might be optimized out, as it doesn't matter. > > 5. Assignment to arrays an

Re: Paren madness (was Re: Regex query)

2002-09-24 Thread Mike Lambert
> 2. Scalar assignment. > > my $a;# 1. > $a = X; > > my $a;# 3. > ($a) = X; > > These should all do the same thing, regardless of X. Consider: $a = (1); and ($a) = (1); > 5. Assignment to arrays and lists. > > $a = (1, 2, 3); # Same as Perl 5's $a = [1,2,3];

RE: Paren madness (was Re: Regex query)

2002-09-24 Thread Aaron Sherman
On Tue, 2002-09-24 at 14:47, David Whipp wrote: > It seems that the fundamental problem is the dichotomy between > a scalar, and a list of 1 elem. Thus, we want After the first couple of messages, that was really no longer *my* concern, but I can't speak for others. My concern was mostly that par

Re: Paren madness (was Re: Regex query)

2002-09-24 Thread Jonathan Scott Duff
On Tue, Sep 24, 2002 at 11:47:16AM -0700, David Whipp wrote: > It seems that the fundamental problem is the dichotomy between > a scalar, and a list of 1 elem. Thus, we want > > $a = 7 > > to DWIM, whether I mean a list, or a scalar. Seems to me that > the best way to solve a dichotomy is to d

RE: Paren madness (was Re: Regex query)

2002-09-24 Thread David Whipp
It seems that the fundamental problem is the dichotomy between a scalar, and a list of 1 elem. Thus, we want $a = 7 to DWIM, whether I mean a list, or a scalar. Seems to me that the best way to solve a dichotomy is to declare it to not to be one: a scalar *IS* a list of one element. The only t

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread John Williams
On Mon, 23 Sep 2002, Trey Harris wrote: > > So then, I think if there's just some clarification about how one-tuples > are formed, I think everything I wrote in my earlier mail can DWIM > correctly. There seems to be no magic here, quotations from LoTR to the > contrary. :-) Your post was very h

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Trey Harris
Replying to myself to clear a few things up... In a message dated Mon, 23 Sep 2002, Trey Harris writes: > 2. Scalar assignment. > > my $a;# 1. > $a = X; > > my $a;# 2. > $a = X; > > my $a;# 3. > ($a) = X; > > my($a) = X; # 4. > > my($a)

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Aaron Sherman
On Mon, 2002-09-23 at 16:58, Trey Harris wrote: > 4. Numeric value. > > The progression spoken about at great length previously: > > +()# == 0 > +(0) # == WHAT? 0? 1? > +(0,1) # == 2 > +(0,1,2) # == 3 > +(0,1,2,3) # == 4 > +(0,...,n) # == n + 1 > >

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Trey Harris
In a message dated Mon, 23 Sep 2002, Luke Palmer writes: > Y'all have it backwards. > > [1,*[2,[3,4,5]],6] # [1,2,[3,4,5],6] > [1,*[2,*[3,4,5]],6] # [1,2,3,4,5,6] > > Flat flattens outwards, not inwards. Ah. *slaps head* of course. That makes much more sense

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Luke Palmer
On Mon, 23 Sep 2002, Jonathan Scott Duff wrote: > On Mon, Sep 23, 2002 at 04:58:55PM -0400, Trey Harris wrote: > > for (1,("a","b","c"),3 { ... } > > > > and > > > > for 1,("a","b","c"),3 { ... } > > > > Now that I've ventured away from DWIMs and more into WIHDTEMs (What In > > Hell Does T

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Jonathan Scott Duff
On Mon, Sep 23, 2002 at 04:58:55PM -0400, Trey Harris wrote: > for (1,("a","b","c"),3 { ... } > > and > > for 1,("a","b","c"),3 { ... } > > Now that I've ventured away from DWIMs and more into WIHDTEMs (What In > Hell Does This Expression Mean), is the above equivalent to > > for 1,qw(a

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Simon Cozens
[EMAIL PROTECTED] (Trey Harris) writes: > May I suggest that we start with some DWIMmy examples Sam sat on the ground and put his head in his hands. 'I wish I had never come here, and I don't want to see no more magic,' he said, and fell silent. -- I hooked up my accelerator pedal in my car to