Idiomatic corrections

TL;DR

gfldex gently provided a more idiomatic approach to Double check a puzzle result

Sadly… under the assumption that I would have understood it.

First things first, read Only infinite elements. This is how Double check a puzzle result should have been coded in an idiomatic way.

I’m in that stage where I honestly have a strong Perl accent (which I like anyway, as I love Perl) and I can’t fully understand people that talk too strict.

For example, I can probably guess what this is for:

(1..6).roll(*)

but I don’t know how to correctly read it. Is it something like take this list and apply the roll whatever times you need? If so, why is the whatever an argument to roll?

Which, of course, led me to this in the documentation:

multi method roll($n --> Seq)

How nice! So whenever there’s an argument, I can put a whatever and this will generate an infinite lazy list! Let’s put it to the test:

$ raku
...
> sub prova ($n) { return 1 .. $n }
&prova
> my $s = prova(*)
1..Inf

Oooooh!

As a nice side effect, I also got to learn a couple additional things:

Time to read something!


Comments? Octodon, , GitHub, Reddit, or drop me a line!