Re: Regex query

2002-09-23 Thread Aaron Sherman
On Sun, 2002-09-22 at 08:07, Simon Cozens wrote: > [EMAIL PROTECTED] (Jonathan Scott Duff) writes: > > Why can't perl be smart enough to figure out what we mean? > > We're talking about lists, the second most fundamental data structure > in the language. > > If we have to resort to much magic to

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: Regex query

2002-09-23 Thread Trey Harris
In a message dated 24 Sep 2002, Aaron Sherman writes: > This is because push is > almost certainly defined as: > > sub push(@target, *@list) { ... } That should be sub push(@target is rw, *@list); but otherwise I think that's right. Now, implementation in Perl 6 (though I assume it's

Re: Regex query

2002-09-23 Thread Aaron Sherman
On Sat, 2002-09-21 at 06:18, Smylers wrote: > $num = @massive; > > C<$num> becomes a reference to C<@massive>, but in a numeric context it > will evaluate to the number of elements in that array. > But in most cases, you would never do this. You would do something like my int $num =

Re: Regex query

2002-09-23 Thread Trey Harris
In a message dated 24 Sep 2002, Aaron Sherman writes: > Grrr... I want that to work, really I do, but since, as Larry has > pointed out, there's no functional difference between an array ref and > an array in Perl 6, they would be the same. This is because push is > almost certainly defined as: >

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: Regex query

2002-09-23 Thread Aaron Sherman
On Mon, 2002-09-23 at 15:48, Luke Palmer wrote: > On 23 Sep 2002, Simon Cozens wrote: > > > [EMAIL PROTECTED] (Luke Palmer) writes: > > > Since we now have an explicit flattening operator (unary *), there's no > > > need to differentiate between a "real" list and a reference to one. > > > > Wha

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: s/// in list context

2002-09-23 Thread John Williams
Two weeks ago, Nicholas Clark wrote: > So would it be possible for s/// to have the same return values as m// > in perl6? Since no one authoritative has responded to this, I will just add my support that it seems like a reasonable request. s/// currently "returns the number of substitutions mad

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: Regex query

2002-09-23 Thread Luke Palmer
On 24 Sep 2002, Simon Cozens wrote: > [EMAIL PROTECTED] (Luke Palmer) writes: > > push @a: [1,2,3,4]; > > > > pushes an array ref onto @a. > > > > push @a: *[1,2,3,4]; > > > > pushes 1, 2, 3, and 4 onto @a (as it would without the * and []). > > Remind me which language this is suppos

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

Re: Regex query

2002-09-23 Thread Simon Cozens
[EMAIL PROTECTED] (Luke Palmer) writes: > push @a: [1,2,3,4]; > > pushes an array ref onto @a. > > push @a: *[1,2,3,4]; > > pushes 1, 2, 3, and 4 onto @a (as it would without the * and []). Remind me which language this is supposed to be, again? -- "Life sucks, but it's better th

Paren madness (was Re: Regex query)

2002-09-23 Thread Trey Harris
I think this discussion has gotten out of hand, and I hope that Larry, Damian or Allison will grace us with a resolution soon. :-) May I suggest that we start with some DWIMmy examples and try to arrive at a mechanism that will make them all DWIM? Here are my opinions, feel free to shoot them do

Re: Regex query

2002-09-23 Thread Luke Palmer
On 23 Sep 2002, Simon Cozens wrote: > [EMAIL PROTECTED] (Luke Palmer) writes: > > Since we now have an explicit flattening operator (unary *), there's no > > need to differentiate between a "real" list and a reference to one. > > What context does "push" impute on its operands? > > If > p

Re: Regex query

2002-09-23 Thread Aaron Sherman
On Sat, 2002-09-21 at 06:38, Smylers wrote: > So if the difference between lists with parens and anon arrays with > square brackets is going away, it may make sense to standardize on the > latter rather than the former. In other words, lists now use square > brackets. > > That frees up parens f

Re: <( .... )> vs <{ .... }>

2002-09-23 Thread Michael G Schwern
On Sun, Sep 22, 2002 at 10:37:59AM -0500, Me wrote: > In several forms of courier, and some other text fonts > I view code in, I find it hard to visually distinguish the > pattern element: I'd suggest a clearer fixed-width font than Courier. Perhaps Monaco, Neep or, if you can find them, Mishaw

Re: hotplug regexes, other misc regex questions

2002-09-23 Thread Andrew Pimlott
On Wed, Sep 18, 2002 at 05:01:35PM +0200, Damian Conway wrote: > Steve Fink wrote: > > print "yes" if "helo" =~ /hel { .pos-- } lo/; > > This definitely has to work. But remember the call to C is on > the "match object" (i.e. $0), not the string. > > Actually, I would expect that *any* pattern

Re: Perl 6 Summary for week ending 2002-09-15

2002-09-23 Thread Josef Hook
On Fri, 20 Sep 2002, Piers Cawley wrote: > Leopold Toetsch <[EMAIL PROTECTED]> writes: > > > Piers Cawley wrote: > > > >> Happy birthday to me! > > > > > > Congratulations. > > > >> ... by my turning 35 on the 15th > > > > > > 44 on 16th - yes Sept. > > Congrats to you too. So, should I s

Re: Regex query

2002-09-23 Thread Simon Cozens
[EMAIL PROTECTED] (Luke Palmer) writes: > Since we now have an explicit flattening operator (unary *), there's no > need to differentiate between a "real" list and a reference to one. What context does "push" impute on its operands? If push @a, [1,2,3,4]; and push @a, 1,2,3,4; are goi

Re: <( .... )> vs <{ .... }>

2002-09-23 Thread Me
> If you can't distinguish braces and parentheses (or quotes and > backquotes in some other fonts), you are in deep trouble in many > languages including perl5 BTW. I've seldom found myself mistaking a brace for a paren or a quote for a backquote when using Perl 5. So maybe you are right. But ma

Re: Regex query

2002-09-23 Thread Andrew Rodland
On Sat, 21 Sep 2002 16:33:31 -0600 (MDT), Luke Palmer said: > You know, the idea that square brackets are the only things that can > make lists is starting to really appeal to me. Similar for squiggles > and hashes. I don't know how many times in my early Perl5 days I did > this: > Since we no

Re: <( .... )> vs <{ .... }>

2002-09-23 Thread Stéphane Payrard
On (22/09/02 10:37), Me wrote: > From: "Me" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Subject: <( )> vs <{ }> > Date: Sun, 22 Sep 2002 10:37:59 -0500 > > In several forms of courier, and some other text fonts > I view code in, I find it hard to visually distinguish the > pattern e