Perl Weekly Challenge 124: Happy Women Day and Tug of War

These are some answers to the Week 124 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days from now (on August 8, 2021 at 24:00). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

Task 1: Happy Women Day

Write a script to print the Venus Symbol, international gender symbol for women. Please feel free to use any character.

Example:

How and What to do in Programming (CY's Take on PWC#075 Task 2) [Edited]

If you want to challenge yourself on programming, especially on Perl and/or Raku, go to https://perlweeklychallenge.org, code the latest challenges, submit codes on-time (by GitHub or email).

---

Continued from the discussion of Task 1.

Task 2 Largest Rectangle Histogram

I am not a narcissist; though some of my actions are narcissistic traits, it does not imply that there is yet another narcissist; I am motivating myself for a better self.

Back to the task. This look like a task testing our overall commanding of the language (especially when the bonus is also considered), not an algorithm-oriented task.

At the first sight, looking for the largest rectangle seems uneasy. My order of coding has been: Perl code, Python code, Java code (3 at a time because I got a day-off on Tuesday) and (after a few days) Lisp code. The following is my note during coding the Perl of the task, informally:

Week #075: Coins Sum & Largest Rectangle Histogram

Please follow the blog where I discuss the two tasks "Coins Sum" and "Largest Rectangle Histogram" of "The Weekly Challenge - 075".

https://perlweeklychallenge.org/blog/weekly-challenge-075

Thoughts on Marshalling and Unmarshalling in Zydeco

Prompted by a recent question on PerlMonks, I've been thinking a bit recently on marshalling and unmarshalling Perl objects. If you're happy using Data::Dumper's format, then it's trivial, but today we're looking at JSON.

If you just want to encode your objects as JSON, that's very easy. Just add a TO_JSON method to all your classes. This can be done in a role to eliminate duplication, and in most cases can be as simple as:

The difficulty comes in going the other direction.

Perl Weekly Challenge 123: Ugly Numbers and Square Points

These are some answers to the Week 123 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due on August 1, 2021 at 24:00. This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

Task 1: Ugly Numbers

You are given an integer $n >= 1.

Write a script to find the $nth element of Ugly Numbers.

Ugly numbers are those number whose prime factors are 2, 3 or 5. For example, the first 10 Ugly Numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12.

Example

Input: $n = 7
Output: 8

Input: $n = 10
Output: 12

Ugly Numbers in Raku

Marketing & Branding Survey Results

You can see the results here.

The following is my reflection on those results and doesn't reflect anyone else's opinions. They may not even really be my opinions.

Who responded?

Some 85.9% respondents self identify as Perl programmers and 22.7% as Raku programmers, 33.2% as Software project leaders, and 30% as Business Owners.

Brand Values

In regards to brand values there is a huge gap between perception and expectation. I've cut off the long tail of "Other" responses for clarity, follow the link at the top to see them.

Screenshot_2020-08-23_17-44-47.png
(The long titles overlap. The first 5 are Amateur, Passionate about helping software projects, Powered by Volunteers, Professional, Secretive)
Screenshot_2020-08-23_17-46-25.png
(The long titles overlap. The first 5 are Passionate..., Powered by Volunteers, Professional, Servant Leadership, Supportive)

Self Challenge and Weekly Challenge (CY's Take on #074 Task 1)

board-game-challenge.jpg

If you want to challenge yourself on programming, especially on Perl and/or Raku, go to https://perlweeklychallenge.org, code the latest challenges, submit codes on-time (by GitHub or email).

Thanks for the volunteers, there are code Reviews on Perl/Raku; in addition, on each Monday, you can read the RECAP linking others' solutions and blogs; I often learn something from both RECAP and Perl Review.

---

One week to the end of August!

Alan J. Perlis said, “A language that doesn’t affect the way you think about programming, is not worth knowing.

I would add a clause to it: unless it helps you earn your living...


Self Challenge

Making risky/improbable promises are usually looked down in Hong Kong, though some people do support the venturesome spirit (not quite for females, but – personal feelings). “Jump-in, jump-out” is not welcomed, as for my understanding to Hongkongers. (I actually stay on Internet more than in Hong Kong society.)

BLOG: The Weekly Challenge #074

https://perlweeklychallenge.org/blog/weekly-challenge-074

Perl Weekly Challenge 122: Average of Stream and Basketball Points

These are some answers to the Week 122 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days, on July 25, 2021 at 24:00. This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

Task 1: Average of Stream

You are given a stream of numbers, @N.

Write a script to print the average of the stream at every point.

Example:

Input: @N = (10, 20, 30, 40, 50, 60, 70, 80, 90, ...)
Output:      10, 15, 20, 25, 30, 35, 40, 45, 50, ...

Average of first number is 10.
Average of first 2 numbers (10+20)/2 = 15
Average of first 3 numbers (10+20+30)/3 = 20
Average of first 4 numbers (10+20+30+40)/4 = 25 and so on.

TPF Survey: Marketing and Branding

As announced on TPF news the Marketing committee of TPF have been running a survey "to learn your responses to the ideas about branding, naming and the perceptions of the values concerning the Perl Foundation itself."

This survey will close in just a few hours, so if you have yet to give your feedback please do so asap!

P.s. Please join the more than 4,000 members of "Perl Programmers" on Facebook

CY's Recent Submission for PWC(068-073) [edited]

Skipped blogging on Perl Weekly Challenge(PWC) for a few weeks! Let's review what I learnt from PWC#068 to PWC#072 first:

PWC#068

Inexperienced in object-oriented, (after a few hours violent trial and error, ) I finally gave up the task #2 reordering a singly linked list.

For the task #1 zero matrix (task statement here), I handled it innocently. By the way, I read the review by Mr Crain and deeply recommend others read Myoungjin Jeon's solution.

PWC#069

Task #1 - Strobogrammatic Number

I use the combinatorics library on CPAN. However, a poorly designed code performs poorly in the face of combinatorial explosion, in comparison with other PWC members' scripts. If I had considered symmetry, as the Perl Reviewer Mr Crain stated, the code would be more effective.

There is a mistake on my code: I treat all single digits as strobogrammatic. Forgetting what happened around during that week...

Perl 7 By Default

Perl 7 has been announced as the next direction of Perl development. My previous blog post explored at a high level the risks and benefits of the announced direction, as well as those of a more incremental proposal. The primary and critical difference between these two approaches is the decision to change interpreter defaults in an incompatible manner; specifically, to have strict and warnings and possibly other features enabled by default for code that does not specify otherwise. I would like to explore each of the arguments presented for this design choice.

Optimizing For New

The primary benefit of changing the implicit defaults is, of course, to allow Perl programmers to write code in a more modern way and newcomers to program in a safer environment without having to know the sometimes arcane or niche ways to activate such an environment.

Perl Weekly Challenge 121: Invert Bit

These are some answers to the Week 121 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due on July 18, 2021 at 24:00. This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

You are given integers 0 <= $m <= 255 and 1 <= $n <= 8.

Write a script to invert $n bit from the end of the binary representation of $m and print the decimal representation of the new binary number.

Example:

Let Mom Help You With Object-Oriented Programming

Mom is a shortcut for creating Moo classes (and roles). It allows you to define a Moo class with the brevity of Class::Tiny. (In fact, Mom is even briefer.)

A simple example:

Patreon eh?

I read today's Perl Weekly and it suggested supporting module authors on patreon. Figured I would give it a try.

I maintain several perl modules, if you depend on any (Such As Test-Simple, Test2, or yath) here is a way to show your support :-)

https://www.patreon.com/exodist

BLOG: The Weekly Challenge #072

https://perlweeklychallenge.org/blog/weekly-challenge-072

Perl Weekly Challenge 120: Swap Odd/Even Bits and Clock Angle

These are some answers to the Week 120 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a couple of days, on July 11, 2021). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

Task 1: Swap Odd/Even Bits

You are given a positive integer $N less than or equal to 255.

Write a script to swap the odd positioned bit with even positioned bit and print the decimal equivalent of the new binary representation.

Example:

Time Challenge (CY's Take on PWC#075 Task 1)

If you want to challenge yourself on programming, especially on Perl and/or Raku, go to https://perlweeklychallenge.org, code the latest challenges, submit codes on-time (by GitHub or email).

Thanks for the volunteers, there are code Reviews on Perl/Raku; in addition, on each Monday, you can read the RECAP linking others' solutions and blogs; I often learn something from both RECAP and Perl Review.

Do tell me, if I am wrong or you strongly oppose my statements!

---

While the weekly challenge is fighting towards new record of number of submissions, I am starting my own programming adventure. Congratulations to CY Fung, she knows how to code in Python and Java now. I am going to submit guest solutions in these two languages for the coming challenges.

Task 1 Coins Sum

LWN: On Perl 7 and the Perl Steering Committee

LWN has covered an email from Rjb's to perl5-porters

Read on: https://lwn.net/Articles/828384/

BLOG: The Weekly Challenge #073

https://perlweeklychallenge.org/blog/weekly-challenge-073

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.