Hello,
I'm trying to understand how nextsame works.
Apparently I started from the wrong assumptions: I thought that once the
first matched sub in the chain called nextsame, the arguments were matched
against the following subs regardless of the return value.
It seems that while the return value is
Hello,
By "never returns" it's not meant that nextsame redispatches to the next sub
and skips the current stack frame. It only means that no statements following
nextsame will be executed. It's the same semantics as with return. So, the best
way to consider nextsame would be to think of it as o
Thank you Vadim, your explanation makes a lot of sense!
On Tue, Jan 19, 2021 at 5:23 PM Vadim Belman wrote:
> Hello,
>
> By "never returns" it's not meant that nextsame redispatches to the next
> sub and skips the current stack frame. It only means that no statements
> following nextsame will be
Hi Folks,
I ran into this situation today, which seems counterintuitive:
my @one = 1,2,3;
my @two = 4,5,6;
my @both = @one,@two;
my @first = @both[0];
say @one.raku;
say @first.raku;
output:
[1, 2, 3]
[[1, 2, 3],]
I was expecting @first and @one to be the same.
I discover
Let's dig in a little
my @one = 1,2,3;
my @two = 4,5,6;
my @both = @one,@two;
at this point @both is an array containing two arrays
> dd @both
Array @both = [[1, 2, 3], [4, 5, 6]]
Showing that assigning into an array variable gives an array, each element
of which can itself be an array.
Wha
On 1/19/21 10:42 AM, yary wrote:
Let's dig in a little
my @one = 1,2,3;
my @two = 4,5,6;
my @both = @one,@two;
at this point @both is an array containing two arrays
> dd @both
Array @both = [[1, 2, 3], [4, 5, 6]]
Showing that assigning into an array variable gives an array, each
eleme
Hi,
I would like to give a perspective a bit different to what yary provided.
Your example here can be golfed down to:
my $a = [1,2,3];
my @v = $a;
say @v; # [[1,2,3],]
The reason for this behavior is $a being a scalar container. Correspondingly,
when you assign it to @v the assignment op see
> On Jan 19, 2021, at 12:18 PM, Brian Duggan wrote:
>
> Hi Folks,
>
> I ran into this situation today, which seems counterintuitive:
>
> my @one = 1,2,3;
> my @two = 4,5,6;
> my @both = @one,@two;
> my @first = @both[0];
> say @one.raku;
> say @first.raku;
>
> output:
>
> [1, 2, 3]
>
Thanks everyone for the thoughtful replies.
I think this helped me the most --
On Tuesday, January 19, Vadim Belman wrote:
> We have a documentation section on this:
> https://docs.raku.org/language/list#Itemization
"itemization in Arrays is assumed"
...
"It was decided all those extra
Food for thought...
Python:
one = 1,2,3
two = 4,5,6
both = one,two
first = both[0]
print(one) # (1, 2, 3)
print(first) # (1, 2, 3)
Python's `=` operator is like Raku's `:=`.
my @one := 1,2,3;
my @two := 4,5,6;
my @both := @one,@two;
my @first := @both[0];
say @one.raku; # (1, 2, 3)
say
Hi Brian (and Bruce),
Just a short note to say that we had a conversation entitled "Extra .
needed" on this mailing list a few weeks ago, for which the solution
(per Brad Gilbert) was a sort of "double-dereferencing" (for lack of a
better terminology):
https://www.nntp.perl.org/group/perl.perl6.u
On 2021-01-19 2:18 p.m., Brian Duggan wrote:
Hi Folks,
I ran into this situation today, which seems counterintuitive:
my @one = 1,2,3;
my @two = 4,5,6;
my @both = @one,@two;
my @first = @both[0];
say @one.raku;
say @first.raku;
output:
[1, 2, 3]
[[1, 2, 3],]
I was
12 matches
Mail list logo