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 elk caribou;
for
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
Originally this posting was written in response to the 'ref' spec
thread. I included char diagrams that got screwed up, so I made a png
diagram instead (attached) and I re-edited the posting to refer to
attached diagram, and then added some more comments. Hope everyone can
'see' the png.
I
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 =
See diagram case 2 (Class A and Class B intersect):
B are built from a role that represents their intersection ( Class
A U Class B), and then code is added in the definitions of the
It may be just me being confused, but the symbol that looks like a U
(U+222a) is usually union; intersection
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
On 8/29/06, Daniel Hulme [EMAIL PROTECTED] wrote:
Perl up to 5 may be executable line
noise, but I can see Perl 6 being the closest thing yet to executable
maths, and I love it.
Funny, I could have sworn APL was the closest thing yet to executable maths.
( Hey, wait a minute, I'm American;
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,
I accidently sent this directly to Richard. Sorry about that, folks...
-- Forwarded message --
From: Jonathan Lang [EMAIL PROTECTED]
Date: Aug 29, 2006 1:24 PM
Subject: Re: Classes / roles as sets / subsets
To: Richard Hainsworth [EMAIL PROTECTED]
Richard Hainsworth wrote:
I
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
I'm interested in helping to write some tests for return types, but
I'd like some clarifications about them first. Are they just
declarations that help Perl optimize stuff, or they actually contracts?
As this little script shows, both inner and of are valid syntax now
with pugs, but neither is
On 8/30/06, Damian Conway [EMAIL PROTECTED] wrote:
That's a little unfair. Choose good names and it's perfectly clear:
map { Element $^array_index is called $^array_value } == @array.kv;
As an aside, though, doesn't that particular solution now implicitly
rely on the fact that ('index'
Regarding The S06 description of named arguments:
http://feather.perl6.nl/syn/S06.html#Named_arguments
What I find missing here is documentation of the signature to use
if you want to declare I accept an arbitrary number of named
arguments. (Like the param() methods common in Perl5 do).
Maybe
In a message dated Tue, 29 Aug 2006, Mark Stosberg writes:
Regarding The S06 description of named arguments:
http://feather.perl6.nl/syn/S06.html#Named_arguments
What I find missing here is documentation of the signature to use
if you want to declare I accept an arbitrary number of named
On 8/30/06, Mark Stosberg [EMAIL PROTECTED] wrote:
Regarding The S06 description of named arguments:
http://feather.perl6.nl/syn/S06.html#Named_arguments
What I find missing here is documentation of the signature to use
if you want to declare I accept an arbitrary number of named
arguments.
Since a FIRST block gets called at loop initialization time, it seems to me
that it would be useful to have a block closure trait, RESUME, that gets
called at the beginning of every loop iteration except the first. Thus, at
the beginning of each loop iteration either FIRST or RESUME but not both
Trey Harris wrote:
Slurpy parameters follow any required or optional parameters. They are
marked by a C* before the parameter:
sub duplicate($n, *%flag, [EMAIL PROTECTED]) {...}
Named arguments are bound to the slurpy hash (C*%flag
in the above example). Such arguments
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
Sometimes I use 'given' blocks to set a value. To save repeating myself
on the right hand side of the given block, I found I kept want to do this:
my $foo = given { }
...and have whatever value that was returned from when {} or default {}
populate $foo.
It turns out pugs already allow this,
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
Mark Stosberg wrote:
Sometimes I use 'given' blocks to set a value. To save repeating myself
on the right hand side of the given block, I found I kept want to do this:
my $foo = given { }
...and have whatever value that was returned from when {} or default {}
populate $foo.
Isn't it still
On 8/30/06, Mark Stosberg [EMAIL PROTECTED] wrote:
Sometimes I use 'given' blocks to set a value. To save repeating myself
on the right hand side of the given block, I found I kept want to do this:
my $foo = given { }
According to S04, given {} is at statement level, so you can't use it
Hi, there~
I think S04 says too little about statement modifiers. Please comment
on the following code samples. Are they valid Perl 6?
do { say } for 1..3;
{ say } for 1..3;
- $i { say $i } for 1..3;
And how about similar variations for other statement modifiers, such
as while,
28 matches
Mail list logo