Re: A nextsame question

2021-01-19 Thread Vadim Belman
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

A nextsame question

2021-01-19 Thread Fernando Santagata
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

Re: list assignment

2021-01-19 Thread ToddAndMargo via perl6-users
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

Re: A nextsame question

2021-01-19 Thread Fernando Santagata
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

list assignment

2021-01-19 Thread Brian Duggan
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

Re: list assignment

2021-01-19 Thread Ben Davies
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

Re: list assignment

2021-01-19 Thread Brian Duggan
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

Re: list assignment

2021-01-19 Thread Bruce Gray
> 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]

Re: list assignment

2021-01-19 Thread Ralph Mellor
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

Re: list assignment

2021-01-19 Thread William Michels via perl6-users
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):

Re: list assignment

2021-01-19 Thread Vadim Belman
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

Re: list assignment

2021-01-19 Thread yary
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.