develooper Front page | perl.perl5.porters | Postings from February 2022

Re: PSC #054 2022-02-11

Thread Previous | Thread Next
Paul "LeoNerd" Evans
February 16, 2022 12:27
Re: PSC #054 2022-02-11
Message ID:
On Wed, 16 Feb 2022 05:14:16 +0000
Oodler 577 via perl5-porters <> wrote:

> > Also if you're feeling brave and want to try out my PL_infix_plugin
> > branch:
> > 
> >  
> 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      |  |

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About