David Green schreef:
Jonathan Lang:
(In fact, the semantics for @x[*+n] follows directly from the fact
that an array returns the count of its elements in scalar context.)
And @x[*] would be the same as @x[0..^*] or @x[0..(*-1)].
That's an elegance in its favour.
In Perl5 a + can creep in,
OK: before I submit a patch, let me make sure that I've got the
concepts straight:
@x[0] always means the first element of the array; @x[-1] always
means the last element of the array; @x[*+0] always means the
first element after the end of the array; @x[*-1] always means the
first element
On 3/7/07, Jonathan Lang wrote:
summary snipped
Looks good to me.
As well, the fact that @x[-1] doesn't refer to the element
immediately before @x[0] is awkward, as is the fact that @x[*-1]
doesn't refer to the element immediately before @x[*+0]. IMHO, it
would be cleaner to have @x[n]
I like it. I'm a bit strapped for time at the moment, but if you send
me a patch for S09 I can probably dig up a program to apply it with. :)
Larry
Larry Wall wrote:
I like it. I'm a bit strapped for time at the moment, but if you send
me a patch for S09 I can probably dig up a program to apply it with. :)
Could someone advise me on how to create patches?
--
Jonathan Dataweaver Lang
Jonathan Lang skribis 2007-03-06 13:35 (-0800):
Could someone advise me on how to create patches?
Single file:
diff -u oldfile newfile
Entire tree:
diff -Nur oldtree/ newtree/
See also diff(1), and note that when diffing trees, you want to
distclean them first :)
--
korajn salutojn,
On 2/27/07, Jonathan Lang wrote:
David Green wrote:
So I end up back at one of Larry's older ideas, which basically is:
[] for counting, {} for keys.
What if you want to mix the two? I want the third element of row
5. In my proposal, that would be @array[5, *[2]]; in your
proposal, there
On 2/24/07, Jonathan Lang wrote:
In effect, using * as an array of indices gives us the ordinals
notation that has been requested on occasion: '*[0]' means 'first
element', '*[1]' means 'second element', '*[-1]' means 'last
element',
'*[0..2]' means 'first three elements', and so on - and this
David Green wrote:
On 2/24/07, Jonathan Lang wrote:
In effect, using * as an array of indices gives us the ordinals
notation that has been requested on occasion: '*[0]' means 'first
element', '*[1]' means 'second element', '*[-1]' means 'last
element',
'*[0..2]' means 'first three elements', and
Jonathan Lang wrote:
Larry Wall wrote:
: If you want the last index, say '*[-1]' instead of '* - 1'.
: If you want the first index, say '*[0]' instead of '* + 0'.
So the generic version of leaving off both ends would be *[1]..*[-2]
(ignoring that we'd probably write *[0]^..^*[-1] for that
From S09:
When you use * with + and -, it creates a value of Whatever but Num,
which the array subscript interpreter will interpret as the subscript
one off the end of that dimension of the array.
Alternately, *+0 is the first element, and the subscript dwims from
the front or back depending on
On Fri, Feb 23, 2007 at 10:49:34AM -0800, Jonathan Lang wrote:
: That said, I think I can do one better:
:
: Ditch all of the above. Instead, '*' always acts like a list of all
: valid indices when used in the context of postcircumfix:[ ].
Ooh, shiny! Or at least, shiny on the shiny side...
:
Larry Wall wrote:
On Fri, Feb 23, 2007 at 10:49:34AM -0800, Jonathan Lang wrote:
: That said, I think I can do one better:
:
: Ditch all of the above. Instead, '*' always acts like a list of all
: valid indices when used in the context of postcircumfix:[ ].
Ooh, shiny! Or at least, shiny on
On 2/23/07, Jonathan Lang [EMAIL PROTECTED] wrote:
' I'm still debating the boolean context myself. I _think_ it will
work; but I have a tendency to miss intricacies. You might instead
want to require someone to explicitly check for definedness or
existence instead of merely truth; or you
14 matches
Mail list logo