Continues from previous week.
Feel free to submit a merge request or open a ticket if you found any issues with this post. We highly appreciate and welcome your feedback.
For a quick overview, go through the original tasks and recap of the weekly challenge.
Additional feedback to the our Perl Weekly Challenge’s Twitter account is much appreciated.
Task #1
CPAN modules used: Data::Dumper
, DateTime
, DateTime::Duration
, Function::Parameters
, List::Util
, Set::IntSpan
, constant
, feature
, lib
, strict
, warnings
As usual, start with the solution by Nazareno Delucca. The code was easy to follow and pseudocode like. Good for anyone to have a quick idea on how to approach this task. Furthermore, no external CPAN dependencies were used. Likewise with solution by Javier Luque and Laurent Rosenfeld. Then proceed with solution by Adam Russell also opted for simple approach but with difference of using DateTime
and DateTime::Duration
CPAN modules to calculate the duration. Burkhard Nickels also using the same CPAN modules as well.
Instead of just summming up the total time, some participants decided to solve this task with additional rules and constraints. For Duane Powell (make it like the data was obtained from IoT devices) and Saif Ahmed (out-of-sequence data entry and non-contiguous stays).
Solutions that really stood out from the rest. Shortest possible submission by Ruben Westerberg. Totally different approach compares to others using Inversion Lists by E. Choroba. Read his blog post for further details.
Task #2
CPAN modules used: Encode
, Math::RPN
, Scalar::Util
, Test::More
, constant
, feature
, strict
, utf8
, warnings
Another task which utilizes many different programming techniques used by participants in the past challenges.
Start with the solution by Duane Powell which ported the pseudocode to Perl from Wikipedia entry. Something similar also came from Nazareno Delucca.
Participant who used Dispatch Table programming technique were Javier Luque, Laurent Rosenfeld, Roger Bell_West, Steven Wilson, Andrezgz, Colin Crain, E. Choroba, and Ryan Thompson.
And as usual and have been applied by him numerous times in the past challenges, Adam Russell decided to solve this task using a Parser through Parse::Yapp
CPAN module. Read his blog post for further details on its usage. For something slightly different, Burkhard Nickels solved this using available Math::RPN
CPAN module.
Special mentioned of Saif Ahmed which pushed further with additional 50 operators. Likewise for Ryan Thompson which used a generator function to handle all the arity. Read this blog post for more details. Yes, it may be overboard but we love to see every possibilities with Perl.
SEE ALSO
(1) Lights On! by Adam Russell
(2) Parse::Yapp - Introductory Example by Adam Russell
(3) Reverse Polish Guest Book, Raku Edition by Arne Sommer
(4) Perl Weekly Challenge #39 by Burkhard Nickels
(5) Perl Weekly Challenge 039: Guest Book and Reverse Polish Notation by E.Choroba
(6) Perl Weekly Challenge - 039 by Javier Luque
(7) Perl Weekly Challenge # 39: Guest House and Reverse Polish Notation by Laurent Rosenfeld
(8) Reverse Polish Notation by Ryan Thompson
(9) The times you want to avoid the short cuts. PWC-39 by Saif Ahmed