Front page | perl.perl5.porters |
Postings from February 2022
Re: PSC #054 2022-02-11
Thread Previous
|
Thread Next
From:
Paul "LeoNerd" Evans
Date:
February 16, 2022 12:27
Subject:
Re: PSC #054 2022-02-11
Message ID:
20220216122653.1d5c65b5@shy.leonerd.org.uk
On Wed, 16 Feb 2022 05:14:16 +0000
Oodler 577 via perl5-porters <perl5-porters@perl.org> wrote:
> > Also if you're feeling brave and want to try out my PL_infix_plugin
> > branch:
> >
> > https://metacpan.org/pod/Syntax::Operator::Zip
>
> Nice, I do like that the infix notation eliminates the need for the
> lists to be passed as references.
Actually, so does the regular function. It has a callchecker attached
which will rewrite the optree around most common styles of invocation,
so things like
zip( \@arr1, [ qw( more things go here ) ] )
don't actually involve an arrayref. You still have to write such syntax
but it doesn't incur the runtime overhead of doing so.
> I'll check it out. It may be prudent to use the word "interleaves"
> in the description of what it does. Regardless, I'll check out both
> implementations.
Ahyes, a good word.
> Also, to be pedantic; "zip" really just "interleaves" 2 lists. The
> "zip"ing part happens naturally when the interleaved list is assigned
> to a hash on the LHS of the "=". Effectively, though, I think it
> makes more sense to call it "zip" as it's already presented.
Don't confuse it with `mesh`. `mesh` is the one that just interleaves
two lists. `zip` creates a list full of little ARRAYrefs.
--
Paul "LeoNerd" Evans
leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Thread Previous
|
Thread Next