Re: Hyper-slices?

2005-04-18 Thread Rod Adams
David Christensen wrote: I definitely like the hyper stuff how it is; maybe the answer is to just define an infix:[[]] operator which returns the crosswise slice of a nested list of lists. In any case it could be shunted aside to some package and certainly does not need to be in core. Didn't

Re: Hyper operator corner case?

2005-04-18 Thread Thomas Sandlaß
Roger Hale wrote: One set of cases that doesn't seem to have come up in discussion: (1, 3, 2) - (83, 84, 81, 80, 85) Should this give (-82, -81, -79, -80, -85) From an arithmetic point of view it should be exactly that. The implementation might need to morph the code though, see below. as

rx/abc$/

2005-04-18 Thread Autrijus Tang
On Sat, Apr 16, 2005 at 12:10:48PM -0700, Larry Wall wrote: I think I have to clarify what I mean by that last phrase. Trailing delimiters are hidden inside any token that has already been started, but not at the start of a token (where token is taken to be fairly restrictive). Therefore

Re: rx/abc$/

2005-04-18 Thread Larry Wall
On Tue, Apr 19, 2005 at 01:31:12AM +0800, Autrijus Tang wrote: : On Sat, Apr 16, 2005 at 12:10:48PM -0700, Larry Wall wrote: : I think I have to clarify what I mean by that last phrase. Trailing : delimiters are hidden inside any token that has already been started, : but not at the start of a

alarm() and later()

2005-04-18 Thread Gaal Yahas
Two things popped up while implementing a demo version of alarm() today. 1. In perl5 and in most underlying libraries, alarm() has 1 second granularity (and a possible 1 second error on top of that). Can we have the alarm builtin not assume the worst, and take a Num instead of an Int, so that on

Re: Context of hash slices; quotation adverbs

2005-04-18 Thread Roie Marianer
: But when you start interpolating, you get into a big mess: : h\qq[$interpolated] = want(); # ??? : h$foo = want(); # ??? I think that, as with functions called in unknown context, we should just force the RHS here to list context, and rely on the RHS to add extra context as necessary if

Re: Context of hash slices; quotation adverbs

2005-04-18 Thread Larry Wall
On Mon, Apr 18, 2005 at 11:23:34PM +0300, Roie Marianer wrote: : : But when you start interpolating, you get into a big mess: : : h\qq[$interpolated] = want(); # ??? : : h$foo = want(); # ??? : : I think that, as with functions called in unknown context, we should : just force the RHS here

Re: rx/abc$/

2005-04-18 Thread Roie Marianer
LW = Larry Wall AT = Autrijus Tang LW I think I have to clarify what I mean by that last phrase. Trailing LW delimiters are hidden inside any token that has already been started, LW but not at the start of a token (where token is taken to be fairly LW restrictive). AT Consider this: AT AT

Re: Context of hash slices; quotation adverbs

2005-04-18 Thread Kurt Hutchinson
On Mon, Apr 18, 2005 at 11:23:34PM +0300, Roie Marianer wrote: That makes sense, but that would make %num_of_linesfile = @file not DWIM... of course that would translate into %num_of_linesfile = scalar @file so maybe that's OK. In order to promote proper syntactical thinking, note that

junctions as indicies

2005-04-18 Thread David Christensen
I'm looking in S09, and reading about junctions. It seems to me that if we have a junction $j which we use to index into an array or a hash, it should DWIM and return a junction of the corresponding values. @ar=[1..10]; %hash=(a=1,b=4,c=7); $j=1|2|3; $k=a|c; $u = @ar[$j]; # 2|3|4 $v =

Re: junctions as indicies

2005-04-18 Thread Luke Palmer
David Christensen writes: I'm looking in S09, and reading about junctions. It seems to me that if we have a junction $j which we use to index into an array or a hash, it should DWIM and return a junction of the corresponding values. @ar=[1..10]; %hash=(a=1,b=4,c=7); $j=1|2|3; $k=a|c;

Re: Context of hash slices; quotation adverbs

2005-04-18 Thread Larry Wall
On Mon, Apr 18, 2005 at 06:44:55PM -0400, Kurt Hutchinson wrote: : On Mon, Apr 18, 2005 at 11:23:34PM +0300, Roie Marianer wrote: : That makes sense, but that would make : %num_of_linesfile = @file : not DWIM... of course that would translate into : %num_of_linesfile = scalar @file : so

junction adverb: :except

2005-04-18 Thread David Christensen
Hypothetical here: If we want to calculate a set of values for a junction which map nicely to a range with a few outliers, would it be possibly to have a qualifier :except which allows us to make exceptions to our given range? I.e., (Ignore for the moment the inefficiency of the choice of

Re: junction adverb: :except

2005-04-18 Thread Luke Palmer
David Christensen writes: Hypothetical here: If we want to calculate a set of values for a junction which map nicely to a range with a few outliers, would it be possibly to have a qualifier :except which allows us to make exceptions to our given range? I.e., (Ignore for the moment

Re: rx/abc$/

2005-04-18 Thread Larry Wall
On Tue, Apr 19, 2005 at 12:02:45AM +0300, Roie Marianer wrote: : But rx:P5// should act like qr//, shouldn't it? Yes. : LW I suspect we can check after the $ for ), ], |, #, whitespace, or the : LW terminator, which rules out direct use of $/ inside /.../. : I'll add a flag for that in rx:P5. In

statement modifiers for setting variables

2005-04-18 Thread Dave Whipp
The following is legal perl: print $a $b $c if ($a,$b,$c)=(1,2,3); This prints 1 2 3, but the definitions obviously aren't scoped to the modified statement. And a Cmy in the modifier is a bit too late. Any reason to [not] add a Cwhere statement modifier which restricts the scope of the

Re: junctions as indicies

2005-04-18 Thread Paul Hodges
--- David Christensen [EMAIL PROTECTED] wrote: I'm looking in S09, and reading about junctions. It seems to me that if we have a junction $j which we use to index into an array or a hash, it should DWIM and return a junction of the corresponding values. @ar=[1..10]; %hash=(a=1,b=4,c=7);

Re: junctions as indicies

2005-04-18 Thread Luke Palmer
Paul Hodges writes: Maybe, but I don't like returning junctures in those cases unless you *explicitly* ask for it. I'd rather the default be the arbitrary lists returned, or whatever fits the context. How about @ar=[a..z]; %hash=(a=1,b=4,c=7); $j=1|2|3; @j = (1,2,3); $k=a|c;

Re: junctions as indicies

2005-04-18 Thread Rod Adams
Paul Hodges wrote: --- David Christensen [EMAIL PROTECTED] wrote: I'm looking in S09, and reading about junctions. It seems to me that if we have a junction $j which we use to index into an array or a hash, it should DWIM and return a junction of the corresponding values. @ar=[1..10];