The Weekly Challenge - 259

Monday, Mar 4, 2024| Tags: Perl, Raku

TABLE OF CONTENTS


01. HEADLINES

02. SPONSOR

03. RECAP

04. PERL REVIEW

05. RAKU REVIEW

06. CHART

07. NEW MEMBERS

08. GUESTS

09. TASK #1: Banking Day Offset

10. TASK #2: Line Parser


HEADLINES


Welcome to the Week #259 of The Weekly Challenge.

This week tasks are proposed by Lee Johnson and Gabor Szabo. It is an honour for me that we get so much support from the Perl community. Today is the first Monday of the month and time to declare the next champion. With great pride, I announce Mustafa Aydin as our next champion. I know I haven’t done the interview with the last champion, Nelo Tovar, sorry. I will get both done together soon.

I am not sure, if you noticed, Ryan Thompson is back in action. It is always pleasure to have him back. He has been a big supporter of the weekly challenge. I am hoping to see him regular now.



Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.

  Week      Perl       Raku       Blog   
   254       53       32       26   
   255       55       30       26   
   256       57       32       26   
   257       41       25       22   
   258       56       38       30   

Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.

  Week      Guests       Contributions       Languages   
   254       17       62       20   
   255       17       60       18   
   256       17       63       17   
   257       19       61       20   
   258       17       67       19   

TOP 10 Guest Languages


Do you see your favourite language in the Top 10? If not then why not contribute regularly and make it to the top.

 1. Python     (2276)
 2. Ruby       (656)
 3. Haskell    (637)
 4. Lua        (582)
 5. Rust       (540)
 6. C          (485)
 7. C++        (484)
 8. JavaScript (341)
 9. Go         (333)
10. BQN        (318)

Blogs with Creative Title


1. Even Sum by Arne Sommer.

2. Alll about digits by BarrOff.

3. How do I sum thee? Let me count the ones. by Bob Lied.

4. No Mental Bandwidth For A Name by Dave Jacoby.

5. Sum Even Bits by Jorg Sommrey.

6. arrays of sums by Luca Ferrari.

7. Even Digits have a Sum! by Packy Anderson.

8. All about the way numbers are written by Peter Campbell Smith.

9. Valuing the Count by Roger Bell_West.


GitHub Repository Stats


1. Commits: 36,887 (+107)

2. Pull Requests: 9,674 (+40)

3. Contributors: 243

4. Fork: 304

5. Stars: 169 (+1)



In the year 2024, we are looking for new sponsor for monthly winner. If anyone interested please get in touch with us at perlweeklychallenge@yahoo.com. Thanks for your support in advance.


RECAP


Quick recap of The Weekly Challenge - 258 by Mohammad Sajid Anwar.


PERL REVIEW


If you missed any past reviews then please check out the collection.


RAKU REVIEW


If you missed any past reviews then please check out the collection.


CHART


Please take a look at the charts showing interesting data.

I would like to THANK every member of the team for their valuable suggestions. Please do share your experience with us.


NEW MEMBERS


Please find out How to contribute?, if you have any doubts.

Please try the excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


GUESTS


Please check out the guest contributions for the Week #258.

Please find past solutions by respected guests. Please share your creative solutions in other languages.


Task 1: Banking Day Offset

Submitted by: Lee Johnson

You are given a start date and offset counter. Optionally you also get bank holiday date list.

Given a number (of days) and a start date, return the number (of days) adjusted to take into account non-banking days. In other words: convert a banking day offset to a calendar day offset.

Non-banking days are:

a) Weekends
b) Bank holidays

Example 1

Input: $start_date = '2018-06-28', $offset = 3, $bank_holidays = ['2018-07-03']
Output: '2018-07-04'

Thursday bumped to Wednesday (3 day offset, with Monday a bank holiday)

Example 2

Input: $start_date = '2018-06-28', $offset = 3
Output: '2018-07-03'

Task 2: Line Parser

Submitted by: Gabor Szabo

You are given a line like below:


{%  id   field1="value1"    field2="value2"  field3=42 %}

Where

a) "id" can be \w+.
b) There can be 0  or more field-value pairs.
c) The name of the fields are \w+.
b) The values are either number in which case we don't need double quotes or string in
   which case we need double quotes around them.

The line parser should return structure like below:


{
       name => id,
       fields => {
           field1 => value1,
           field2 => value2,
           field3 => value3,
       }
}

It should be able to parse the following edge cases too:


{%  youtube title="Title \"quoted\" done" %}

and


{%  youtube title="Title with escaped backslash \\" %}

BONUS: Extend it to be able to handle multiline tags:


{% id  filed1="value1" ... %}
LINES
{% endid %}

You should expect the following structure from your line parser:


{
       name => id,
       fields => {
           field1 => value1,
           field2 => value2,
           field3 => value3,
       }
       text => LINES
}


Last date to submit the solution 23:59 (UK Time) Sunday 10th March 2024.


SO WHAT DO YOU THINK ?

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

Contact with me