RECAP - Perl Weekly Challenge - 006

Sunday, May 5, 2019| Tags: Perl, Raku

Last week was not very active in terms of number of participations. Having said that the quality of the solutions is always on the top. Some went for the kill, you can’t afford to miss it. Enjoy the code.


Adam Russell

Andrezgz

Adam got the help from CPAN module Data::Dump and the end result is unbelievable simple. Check out his code.

Alicia Bielsa

Alicia Bielsa

Alicia submitted the solution to the first question. It is very well defined and full of usefull comments script. Please take a look here.

Andrezgz

Andrezgz

Andrezgz came up with sub compact_term() which does the job. Checkout the code. For the second challenge, he went for the kill with this line below.

**print Math::BigFloat->new(163)->bsqrt->bmul(bpi)->bexp(32);**.

Arpad Toth

Andrezgz

Arpad came up with one-liner which appears to be very complicated but does the job. It is certainly not easy to read. You decide, here is the code.

Athanasius

Athanasius

Athanasius solution used not so common syntax e.g. push $runs[-1]->@*, $n;. It is not commonly used syntax but I have come across few people who likes it. It looks nice, I must admit. Have a look here. The second challenge solution used Math::BigFloat as in here.

Daniel Mantovani

Daniel Mantovani

Daniel came up with unique solution, at first, I couldn’t believe it would give the correct result. I was wrong it does return the correct answer. You must checkout yourself.

Duncan C. White

Duncan C. White

Duncan’s solution is short and easy to read. However there is a magic in it. Take a look here. But for the second challenge, he went for one liner like below:

**perl -Mbigrat=bexp,bpi -e 'print bexp(bpi(32)*sqrt(163),32)."\n"'**.

E. Choroba

E. Choroba

E. Choroba is making good use of CPAN distribution String::Util::Range. See it yourself here. Like others his solution also used Math::BigFloat but in a unique way like this.

Guillermo Ramos

Guillermo Ramos

Guillermo’s sub compact() is very interesting and well documented. Please take a look here.

Gustavo Chaves

Gustavo Chaves

Gustavo made the challenge looks like child play. He is too good. Take a look at his work here. For second challenge, he made it so simple with this line

**say PI()->bmul(sqrt(163))->bexp(32);**.

Jaldhar H. Vyas

Jaldhar H. Vyas

Jaldhar’s solution is without any gimmicks. Use of simple looping logics gives the result. Take a look here. For the second challenge, he came up with one liner.

Joelle Maslak

Joelle Maslak

Joelle’s solution looks full of magic, specially this line below:

**say join( ",", map( { ( $_->[0] != $_->[1] ) ? join( '-', @$_ ) : $_->[0] } @runs ) );**.

Checkout the full code here. And for the second challenge, she surprised me again with this line.

**say substr(640320**3 + 744 - 196844/(640320**3 + 744), 0, 34);**

Kian-Meng Ang

Kian-Meng Ang

Kian-Meng’s solution is clean. I am sure you will agree with me.

Laurent Rosenfeld

Laurent Rosenfeld

Laurent is one of the few members who consistently blog about his solutions. He also submits solutions in Perl5 and Perl6. Checkout his two blogs one and two.

Maxim Kolodyazhny

Maxim Kolodyazhny

Maxim use of CPAN module List::Util is really cool. You must take a look here. For the second challenge, he proposed this one line:

**say bexp( PI * sqrt(163), 80 );**.

Ruben Westerberg

Ruben Westerberg

Ruben simple use of pop and push is so beautiful. Checkout his code.


Last but not the least, I would like to request all members, at least the one who blogs, please send us your photo to use in the weekly blog, if not already sent.

SO WHAT DO YOU THINK ?

If you have any suggestions or ideas then please do share with us.

Contact with me