Spoiler Alert: This weekly challenge deadline is due in a couple of days (July 19, 2020). 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: Strobogrammatic Numbers
A strobogrammatic number is a number that looks the same when looked at upside down.
You are given two positive numbers
$B such that
1 <= $A <= $B <= 10^15.
Write a script to print all strobogrammatic numbers between the given two numbers.
Input: $A = 50, $B = 100 Output: 69, 88, 96
At the recent Conference in the Cloud for Perl and Raku, Sawyer X (the pumpking of Perl) announced an ambitious plan for Perl 7. Since Perl 6 was renamed to Raku to better communicate its fundamental differences from the well known identity of Perl, major versions are now available again for Perl to leverage, and it is a very important step to show that the language is still developed and used. I completely agree with the motivation and ideals presented, and have thought a lot about the benefits and risks involved in such ideas long before I was aware of this project.
I write my thinking and question about Proposal for Perl 7.
1. MAJOR version when you make incompatible API changes,
First of all, I am wondering about this assumption.
This is because there are very few incompatible API changes in Perl's history (Perl 1, 2, 3, 4, 5).
If the Python developers are thinking this way, it makes sense.
Has Perl ever thought of this in history?
Perhaps Perl has kept the maximum backward compatibility even in the major version upgrade?
The fact about Perl (rather than theory or ideal) is that Perl has kept its backward compatibility so that it can execute the assets of older programs.
Perl has taken care of old users who use Perl for a long time and cannot easily change their habits.
I believe this is Perl's kindness.
Perl is a language that emphasizes facts, reality and work, practicality.
Perl 5 has been very successful because it keeps backword compatibility with Perl 4.
I believe that this idea will be very successful even when upgrading from Perl 5 to Perl 7.
Because it really succeeded.
Task 1: Zero Matrix
You are given a matrix of size
M x N having only 0s and 1s.
Write a script to set the entire row and column to 0 if an element is 0.
Input: [1, 0, 1] [1, 1, 1] [1, 1, 1] Output: [0, 0, 0] [1, 0, 1] [1, 0, 1]
I'm very keen to be actively deprecating and removing syntactic oddities that folks should already be prohibiting via good perlcritic policies (i.e linting) hopefully in their editors and CI pipelines.
And standard perl is a good way for code bases to prepare for the future and derive real benefits right now. Both build on the meritocracy approach of CPAN.
It is that meritocracy that brought us the object frameworks Moose (which people seemed to feel was too big) and then Moo+Type::Tiny (which people seem to feel is about right). There are many other frameworks (object systems) which perl's minimalist internal object functions enable people to write, if one of them strikes a better balance of trade off's then there is nothing to stop it supplanting Moo as number one.
Overall, I think the Perl 7 announcement is great news.
I only have one small objection:
Hegel remarks somewhere that all great world-historic facts and personages appear, so to speak, twice. He forgot to add: the first time as tragedy, the second time as farce.
The Eighteenth Brumaire of Louis Napoleon - Karl Marx
Sawyer just announced his plans for perl 7. And while Perl 7 sounds like a lovely language, I do see a number of issues:
Cohabitation / Forking
The proposal is presented as a linear progress, I don't believe this is realistic. This would be fork much like the python 3 transition is (which also wanted to be a simple linear progression). As we all know, they're currently in year 12 of a 5 year transition.
There are several problems here. CPAN as an ecosystem is the one that is given most attention to (not without reason; it is without doubt the most important collection of Perl code), but it's not even the biggest problem.
Sawyer X, Perl's volunteer Project Lead, announced at The Perl Conference in the Cloud that Perl will make the jump to a new major version, Perl 7. This allows the next version to accept saner, more modern default settings. So far, Perl 5 has been compatible back its first release in 1994. Perl 7, expected to be released within the next year, sets defaults and enables features that most people use today. When Perl 7 is released, Perl 5 will go into long term maintenance for an extended window far beyond its normal two-year, two version support policy. Supported Perl 5 versions will continue to get important security and bug fixes.
You are given two positive numbers
Write a script to list all positive numbers having exactly
$N digits where sum of all digits equals to
Input: $N = 2 $S = 4 Output: 13, 22, 31, 40
Digit Sum in Raku
My first attempt to solve the problem would be a pure brute force approach as follows:
Good morning from the Asian timezone.
This is a part of Perl Weekly Challenge(PWC) and the followings are related to my solutions. If you want to challenge yourself on Perl, go to https://perlweeklychallenge.org, code the latest challenges, submit codes on-time (by GitHub or email)(before Monday GMT+0 00:00) if possible, before reading my blog post.
I just rediscovered an old project of myself when I was learning Perl/XS and wanted to drop a hint to it here.
It might be useful for others who also have no idea how XS works and who would benefit from the approach and point of view of another XS newbie.
It is both the step-by-step description and a CPAN-ready Perl distribution.
You can find it on github:
Wouldn't it be nice to be able to change my (hacked) password for blogs.perl.org?
Unfortunately, the password change form complains that it couldn't verify my current password, which doesn't come as a surprise as there is no field on the form to enter it.
Spoiler Alert: This weekly challenge deadline is due in a couple of days (July 5, 2020). 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: Number Combinations
You are given two integers
$n. Write a script print all possible combinations of
$n numbers from the list
1 2 3 … $m.
Every combination should be sorted i.e. [2,3] is valid combination but [3,2] is not.
Input: $m = 5, $n = 2 Output: [ [1,2], [1,3], [1,4], [1,5], [2,3], [2,4], [2,5], [3,4], [3,5], [4,5] ]
Note that I don’t consider the formatting of the displayed output above to be part of the task.
Number Combinations in Raku
I plan to release SPVM 1.0 at the end of July.
If you have any feedback on the bugs or features, please contact Github Issue or firstname.lastname@example.org
I am trying to contact Junnama Noda author of Net::Azure::StorageClient
I have sent two emails now to the public email address listed in his public github profile and have received no bounce or response.
If anyone is in contact with him, please have him contact me
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a design donated by Six Apart, Ltd.