develooper Front page | perl.perl6.users | Postings from October 2020

Re: Brace interpolation in strings creates a new scope?

Thread Previous | Thread Next
Sean McAfee
October 26, 2020 22:25
Re: Brace interpolation in strings creates a new scope?
Message ID:
On Mon, Oct 26, 2020 at 12:04 PM Elizabeth Mattijsen <> wrote:

> Personally, I would avoid the use of the anonymous state variable.  I
> think it is an example where Larry would nowadays apply rule #2.

Well, I wouldn't use a construction like that in real code.  It just seems
like one of the simpler ways to introduce anonymous state variables.

For the end of my talk, I plan to explore a golfing challenge I worked on a
while ago that calls for zipping two infinite sequences together with the
replication operator xx, where the second sequence is:

1, 1, 2, 2, 3, 3, 4, 4, ...

I wasn't really happy with any of the ways I came up with to generate that
second sequence, like:

{ 1 + $++ div 2 } ... *
map * div 2, 2 .. *

Then I had the sudden inspiration that xx coerces its second argument to
Int, meaning all I really needed was:

1, 1.5 ... *

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