Damian (), Ruud (), Damian (), Carl ():
But it can hardly be blamed for clarity.
That's a little unfair.
can hardly be blamed - can easily be praised g
Apologies to Carl if I misinterpreted. I read it as:
can hardly be blamed for (having) clarity
;-)
No, yours is the correct
Damian Conway schreef:
[for @array - $index, $value {...}]
No. There's no such magic. I simply screwed up. I should have written:
for @array.kv - $index, $value {...}
:-(
Ah, much clearer now. g
--
Affijn, Ruud
Gewoon is een tijger.
Carl Mäsak wrote:
But maybe a variable that implicitly carries along the loop index
would be even snazzier?
for @array - $val {
say $.\t$val;
}
Or give the block a name (label), and have an index (or several indexes, like
some that are reset by redo an some that are not) available,
Ruud (), Carl ():
But maybe a variable that implicitly carries along the loop index
would be even snazzier?
for @array - $val {
say $.\t$val;
}
Or give the block a name (label), and have an index (or several indexes, like
some that are reset by redo an some that are not) available,
Carl Mäsak wrote:
Yobert Hey do you know what would be cool in perl 6
Yobert A special variable for when you do a for (@array) style loop
Yobert it would always have the index of the array
Discussed on #perl6: it's already quite easy in Perl 6 to loop with an
explicit index:
my @array = moose
Carl Mäsak schreef:
Ruud:
Carl:
But maybe a variable that implicitly carries along the loop index
would be even snazzier?
for @array - $val {
say $.\t$val;
}
Or give the block a name (label), and have an index (or several
indexes, like some that are reset by redo an some that are
Mark (), Carl ():
Yobert Hey do you know what would be cool in perl 6
Yobert A special variable for when you do a for (@array) style loop
Yobert it would always have the index of the array
Discussed on #perl6: it's already quite easy in Perl 6 to loop with an
explicit index:
my @array =
Carl Mäsak schreef:
I suppose doing a map or a grep over @array.kv is possible:
pugs my @array = london bridge is falling down
(london, bridge, is, falling, down)
pugs map { Element $^a is called $^b }: @array.kv;
(Element 0 is called london,
Element 1 is called bridge,
Element 2 is
Having read this thread, I tend to think you're insane for bringing it
up again :-)
That said, I'll entertain the discussion for a bit ...
On Tue, Aug 29, 2006 at 08:33:20AM +0200, Carl Mäsak wrote:
Questions:
- Is the itch big enough for this? The more I look at the first piece
of code,
pugs map { Element $^a is called $^b }: @array.kv;
(Element 0 is called london,
Element 1 is called bridge,
Element 2 is called is,
Element 3 is called falling,
Element 4 is called down)
But it can hardly be blamed for clarity.
That's a little unfair. Choose good names and it's perfectly
Damian Conway schreef:
[attribution repaired] Carl:
But it can hardly be blamed for clarity.
That's a little unfair.
can hardly be blamed - can easily be praised g
--
Affijn, Ruud
Gewoon is een tijger.
But it can hardly be blamed for clarity.
That's a little unfair.
can hardly be blamed - can easily be praised g
Apologies to Carl if I misinterpreted. I read it as:
can hardly be blamed for (having) clarity
;-)
Damian
Damian Conway schreef:
Ruud:
Damian:
Carl:
But it can hardly be blamed for clarity.
That's a little unfair.
can hardly be blamed - can easily be praised g
Apologies to Carl if I misinterpreted. I read it as:
can hardly be blamed for (having) clarity
;-)
Nah, I was just joking;
for @array - $index, $value
{
say Element $_ is called $value
}
But I don't understand how the $index, $value pair gets its values; is
@array somehow turned into a hash with the index as the key?
With @array - $index, $value {}, is $_ an alias of $index?
No. There's no such
14 matches
Mail list logo