Re: (sigils are awesome, they say ...) Re: pairs of separators from a string

2021-08-23 Thread yary
A little more of Vadim's example > my $a = ; say $a.raku; ("a", "b", "c") > my @a = ; say @a.raku; ["a", "b", "c"] > @a[1]='X'; say @a.raku; ["a", "X", "c"] > $a[1]='X' Cannot modify an immutable List ((a b c)) in block at line 1 $a is a scalar container, holds one thing. In this example a

Re: (sigils are awesome, they say ...) Re: pairs of separators from a string

2021-08-22 Thread Vadim Belman
Sigils mean a lot. For example, they create a context: my $a = 1,2,3; my @a = 1,2,3; $a = ; say $a.raku; @a = ; say @a.raku; If you have some (actually, a lot of) spare time you can watch my class from TRC2021 where I cover a lot about symbols/sigils/object interaction in Raku:

Re: (sigils are awesome, they say ...) Re: pairs of separators from a string

2021-08-22 Thread Brian Duggan
On Sunday, August 22, Marc Chantreux wrote: > my ($a, $b) = { @^a[0,2...Inf], @a[1,3...Inf] }.(q<(){}[]>.comb); say $a[0]; > say $b[0] > > oh. i never see this direct call of a lambda before but it really makes > sense! this is the answer i like the most. I think it's possible to avoid the

Re: (sigils are awesome, they say ...) Re: pairs of separators from a string

2021-08-22 Thread Fernando Santagata
On Sun, Aug 22, 2021 at 2:58 PM Marc Chantreux wrote: > so of course i tried > > my (@a, @b) = { .[0,2…∞], .[1,3…∞] }.(q.comb); > > because i have two lists and two containers. this doesn't work. > which means @ and $ combines with = to define how things are stored > but i don't understand how

(sigils are awesome, they say ...) Re: pairs of separators from a string

2021-08-22 Thread Marc Chantreux
thanks everyone for sharing, Vadim, my ($a, $b) = { @^a[0,2...Inf], @a[1,3...Inf] }.(q<(){}[]>.comb); say $a[0]; say $b[0] oh. i never see this direct call of a lambda before but it really makes sense! this is the answer i like the most. i rewrote it my way and this works my ($a, $b) = {