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 Li
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:
https://conf.ra
Hi Marc!
Is it just even/odd elements that you want to separate out? If so, maybe
.grep() is your friend here:
> my $string0 = q!""''(){}[]!
""''(){}[]
> $string0.comb[(0..*-1).grep(* %% 2)].say;
(" ' ( { [)
> $string0.comb[(0..*-1).grep(* % 2)].say;
(" ' ) } ])
It sounds like you have some inte
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 expl
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 fo
hello William,
> your string, or whether-or-not some might be nested within each other. You
> show a lone ampersand ("&") at the beginning of your example, but other
> strings may not be so simple.
really sorry about this artefact from previous attempts :(
> > $string.comb(/ ( <:Ps> ~ <:Pe> .?)
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) = { .[0,
Hi Marc (and yary)!
I'll give this a shot, focusing on bracket pairs. It's not clear from your
question whether there's any inherent order to the bracket characters in
your string, or whether-or-not some might be nested within each other. You
show a lone ampersand ("&") at the beginning of your ex
I guess you need something like this:
my ($a, $b) = { @^a[0,2...Inf], @a[1,3...Inf] }.(q<(){}[]>.comb); say $a; say $b
Best regards,
Vadim Belman
> On Aug 21, 2021, at 3:04 AM, Marc Chantreux wrote:
>
> hello,
>
> i would like to get the list of opening (α) and closing
> (ω) separators from
This reminds me of "the comma rule" which I haven't quite internalized yet.
This gets a little closer
map { .[0,2…∞], .[1,3…∞] }, ("012345".comb,)
(((0 2 4) (1 3 5)))
and my instinct is that "map" is adding a layer you don't need or want for
this issue, should just be sending the results of comb
10 matches
Mail list logo