So, I have found workaround for now:
> my $ar = [1,2,3]; loop ( my $i = 0; $i < $ar.elems; $i++ ) { $ar[$i].say }
1
2
3
2008/10/30 Илья <[EMAIL PROTECTED]>:
> I have found one:
>> my $ar = [1,2,3]; my $i = 0; while $i < $ar.elems {say $ar[$i]; $i++ };
> 1
> 2
> 3
>
>
> 2008/10/30 Carl Mäsak <[EMA
On Fri, 2008-31-10 at 11:31 +0100, Carl Mäsak wrote:
> >> > for @$ar { ... }
> >> > or even
> >> > for @ $ar { ... }
> >> > or
> >> > for @($ar) { ... }
>
> Guy (>):
> > for ( @$ar ) { ... }
> >
> > ?
>
> That's Moritz' first suggestion, but with a pair of unnecessary
> parentheses thrown in. :)
Guy (>), Carl (>>), Moritz (>>>):
>> > for @($ar) { ... }
>>
>> This would arguably be the nicest variant.
Well, actually, by "this" I meant all three variants that Moritz suggested. :)
>> > for @$ar { ... }
>> > or even
>> > for @ $ar { ... }
>> > or
>> > for @($ar) { ... }
Guy (>):
> for ( @$a
On Thu, 2008-30-10 at 17:25 +0100, Carl Mäsak wrote:
> > for @($ar) { ... }
>
> This would arguably be the nicest variant.
for ( @$ar ) { ... }
?
--
--gh
Moritz (>), Илья (>>):
>> I have array ref
>> my $ar = [1,2,3];
>> how can I go over it?
>
> Currently I think you can't, because the array contextualizer isn't
> implemented yet. I think it should be
>
> for @$ar { ... }
> or even
> for @ $ar { ... }
> or
> for @($ar) { ... }
This would arguably
Илья wrote:
> Hi there,
> question about arrays and array refs in Rakudo today.
>
> I have array ref
> my $ar = [1,2,3];
> how can I go over it?
Currently I think you can't, because the array contextualizer isn't
implemented yet. I think it should be
for @$ar { ... }
or even
for @ $ar { ... }
or
Timothy (>):
>>> my $r = <1 2 3>; for $r -> $t { say $t };
>>
>> Which revision of Rakudo are you running? In my r32239, it outputs "1
>> 2 3" on the same line (i.e. it doesn't iterate over each element).
>
>Oops. My bad. Try either of the following with parrot 0.8.0.
>
> perl6 -e 'my $r
On Thu, 30 Oct 2008, Carl Mäsak wrote:
Timothy (>):
my $r = <1 2 3>; for $r -> $t { say $t };
Which revision of Rakudo are you running? In my r32239, it outputs "1
2 3" on the same line (i.e. it doesn't iterate over each element).
Oops. My bad. Try either of the following with par
On Thu, 30 Oct 2008, wrote:
Hi there,
question about arrays and array refs in Rakudo today.
I have array ref
my $ar = [1,2,3];
how can I go over it?
I try:
my $r = [1,2,3]; say $r.elems;
3
my $r = [1,2,3]; say $r.WHAT;
Array
my $r = [1,2,3]; "Y".say for $r;
Y
my $r = [1,2,3]; .say
Timothy (>):
> my $r = <1 2 3>; for $r -> $t { say $t };
Which revision of Rakudo are you running? In my r32239, it outputs "1
2 3" on the same line (i.e. it doesn't iterate over each element).
// Carl
Hi there,
question about arrays and array refs in Rakudo today.
I have array ref
my $ar = [1,2,3];
how can I go over it?
I try:
> my $r = [1,2,3]; say $r.elems;
3
> my $r = [1,2,3]; say $r.WHAT;
Array
> my $r = [1,2,3]; "Y".say for $r;
Y
> my $r = [1,2,3]; .say for $r;
1 2 3 #one string
> my $r =
11 matches
Mail list logo