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

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

Perl Weekly Challenge 125: Pythagorean Triples

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

Task 1: Pythagorean Triples

You are given a positive integer $N.

Write a script to print all Pythagorean Triples containing $N as a member. Print -1 if it can’t be a member of any.

Triples with the same set of elements are considered the same, i.e. if your script has already printed (3, 4, 5), (4, 3, 5) should not be printed.

The famous Pythagorean theorem states that in a right angle triangle, the length of the two shorter sides and the length of the longest side are related by a²+b² = c².

A Pythagorean triple refers to the triple of three integers whose lengths can compose a right-angled triangle.

Example:

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)

BLOG: The Weekly Challenge #074

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

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 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:

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.

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

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

BLOG: The Weekly Challenge #072

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

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/

Supporting Perl-related creators via Patreon and GitHub

Yesterday I posted about this in the Perl Weekly newsletter and both Mohammad and myself got 10 new supporters. This is awesome.

There are not many ways to express the fact that you really value the work of someone.
You can send them postcards or thank-you notes, but when was the last time you remembered to do that?

Right, I also keep forgetting to thank the people who create all the free and awesome stuff I use.

Giving money as a way to express your thanks is frowned upon by many people, but trust me, the people who open an account on Patreon to make it easy to donate them money will appreciate it.

In any case it is way better than not saying anything.

Patreon, GitHub sponsor and Perl

So pick one or all three of us and depending on your financial possibilities sign up to give a monthly donation.

Update

New names were added and support via GitHub is also mentioned.

I've posted the list of Perl-related creators who have a Patreon or GitHub sponsors account on the Perl Maven site where updating the list is just a Pull-request away.

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.

BLOG: The Weekly Challenge #071

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

Perl7 is a fork of values

Before reading this, you should watch this video where Bryan Cantrill explains a value-conflict between Joyent and Node.js, I believe we have a similar problem.

In it he defines a list of project values:

values

All these values are important - but they are in tension. In the end one has to choose between them.

Perl's has traditionally prioritized certain values over these others, and in my experience these are:

  • Expressiveness
  • Extensibility
  • Stability

Polling for fun and engagement

I've been posting some Perl related polls in Perl Programmers over the last few weeks. Despite the obvious weaknesses in the sampling method, they've provided some good insights and great talking points.

Here's some results as of this afternoon. People can still respond to these polls.

Regarding area's where Perl could help out:
Screenshot_2020-07-27_20-33-52.png
This surprised me, I didn't expect Performance Monitoring to come out on top.


Regarding what Perl is being run on:
Screenshot_2020-07-27_20-32-46.png
This didn't surprise me at all. The weakness in this poll is that we didn't find out if people are using their own App Perl or the System Perl. But we know that CentOS+RHEL & Debian+Ubuntu are what the majority are running, with Windows and MacOS being important too.

Regarding the question of Perl's logo:
Screenshot_2020-07-27_20-28-45.png
Folks seem to be happy with the Raptor and feel a bit of a facelift is all that's needed. My favorite suggestion (in the comments) was for a new Perl7 logo was a bike shed.

I will use more polls to dive deeper in the above in the near future. Please come Join Us

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:

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.)

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.