Front page | perl.perl6.users |
Postings from August 2021
Re: (sigils are awesome, they say ...) Re: pairs of separators froma string
Thread Previous
|
Thread Next
From:
Vadim Belman
Date:
August 22, 2021 19:38
Subject:
Re: (sigils are awesome, they say ...) Re: pairs of separators froma string
Message ID:
BA84D4F3-095D-440B-8E09-07F4E6FCE4A8@lflat.org
Sigils mean a lot. For example, they create a context:
my $a = 1,2,3;
my @a = 1,2,3;
$a = <a b c>; say $a.raku;
@a = <a b c>; 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.raku.org/talk/154 <https://conf.raku.org/talk/154>
https://conf.raku.org/talk/163 <https://conf.raku.org/talk/163>
Best regards,
Vadim Belman
> On Aug 22, 2021, at 8:57 AM, Marc Chantreux <eiro@phear.org> wrote:
>
> 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,2…∞], .[1,3…∞] }.(q<AABBCCDD>.comb);
>
> it would be nice if this one will:
>
> my ($a, $b) = { .[0,2…∞], .[1,3…∞] }.: q<AABBCCDD>.comb;
>
> But here is one of the reasons i'm still unconfortable with raku is the
> fact that sigils don't make sense anymore to me (in the contrary of perl
> were sigils means "i want a [$%@] from this").
>
> so as i can't get grid of sigils in this case
>
> my (\a, \b) = { .[0,2…∞], .[1,3…∞] }.(q<AABBCCDD>.comb);
>
> i need to choose a sigil. The way i understand sigils is
> "an optional type specifier". to me
>
> my $truc => my container 'truc' for anything you want
> my @truc => my container 'truc' for something that should mostly
> be understood as indexed
> my %truc => my container 'truc' for something that should mostly
> be understood as associative
>
> so of course i tried
>
> my (@a, @b) = { .[0,2…∞], .[1,3…∞] }.(q<AABBCCDD>.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 for the moment.
>
> regards,
> marc
>
Thread Previous
|
Thread Next