In addition to Native Variable-Length Lookbehind, Perl 5.29.9 (sic) includes another Regexp enhancement: wildcard Unicode property values. (And yes, this blog post sat around in draft form for over a month.)
Despite its name, the implementation is in terms of regular expressions rather than traditional wildcards. An example may be better than an explanation here: instead of writing /[\p{Script=Latin}\p{Script=Greek}]/, the new feature allows you to write /\p{Script=<\A(Latin|Greek)\z>}/. This is, according to perlunicode, a partial implementation of the Unicode Consortium's Wildcards in Property Values. Something like /\p{<Latin|Greek>}/ will not work, nor will /\p{Is_<Latin|Greek>}/; you must specify property name = ... to access this functionality.
Note the need for anchors in the above example. Something like /\p{Script=<ee>}/ would match any script whose name contained a double "e".
Challenge 1 (compact numeric ranges) was covered in this post.
Challenge 2 was as follows:
Create a script to calculate Ramanujan’s constant with at least 32 digits of precision. Find out more about it here (Wikipedia link).
The Wikipedia link provided in the question concerning this second challenge was apparently changed some time after the challenge was initially posted.
The original link, posted on Monday, April 29, 2019, was pointing to the Landau-Ramanujan Constant, which relates to the sum of two squares theorem.
Then, two days later, on May 1, 2019, I noticed that the link had changed and pointed towards this other Wikipedia page about Ramanujan's constant, which refers to irrational (well, in this case, actually transcendental) numbers that almost look like integers. I do not know when exactly the Wikipedia link was changed.
Another great Perl software that I find very useful is Monitorix.
Monitorix is FOSS lightweight system monitoring designed to monitor as many services and system resources as possible.
The tl;dr is that it works really well for monitoring stand alone machines- which is what I used it for. It's tracks all sorts of metrics with minimal configuration by me, and with packages for most distros its trivial to install and update.
Last month was mostly dedicated to the "Perl Weekly Challenge". It took most of my spare time and because of that I had to delay my other pet project "London Hack Day". I promise to get it going soon. The "Perl Weekly Challenge" is now settling down quite well. I have had positive feedback so far. We now have 77 active members. It is also becoming popular on Twitter as we now have 117 followers with over 300+ tweets. It is nice to see how Perl5 and Perl6 communities worked on this project without any issues. If you have time then please take a look at the Knowledge Base.
Let's take a quick look through last month main activities.
Pull Request
Git Commits
Perl Weekly Challenge
Pull Request Club
Perl Blog
PerlWeekly Newsletter
Adopt CPAN Module
Pull Request
60 Pull Requests submitted in the month of April. With this I have now completed 50+ Pull Request every month so far in the year 2019, one of my new year resolutions.
This week, after having read the tasks, I decided to demonstrate the power of CPAN. There already are modules that solve the problems, so the only skill you need is the art of searching CPAN.
Spoiler alert: this post reveals breaking details about the plot of forthcoming episodes of Game of Thrones. Oops, no, that's not what I meant to say. As of this writing, the Perl Weekly Challenge # 6 is still going until Sunday May 10, 2019, please don't read on if you intend to solve the challenge by yourself.
The Wikipedia link provided in the question concerning the second challenge (Ramanujan's Constant) was apparently changed some time after the challenge was initially posted. I worked on the original link (and the Landau-Ramanujan Constant), only to find out a couple of days later that the question is now different. Because of that, I'll hopefully cover the second challenge in a later post (and will try to provide at least partial answers for both constants associated with the name of Srinivasa Ramanujan).
I was grateful to attend for the first time the Perl Toolchain Summit, held this year in Marlow, UK at the Bisham Abbey. I got to meet many of the talented and persistent contributors to the Perl CPAN infrastructure, and also see a country outside North America for the first time. The Perl Toolchain summit is a great event, made possible by the organizers and sponsors, that enables contributors of the Perl CPAN infrastructure to get together and do important work. You can see the results of my project this year at https://cpandeps.grinnz.com (example).
The Project
I decided for my first project, which took the majority of the summit, to work on a replacement for the Stratopan dependency graphs, which have unfortunately gone AWOL. I used these graphs often from MetaCPAN to visualize the dependency impact of a CPAN distribution.
The Perl Toolchain summit is an opportunity for the developers and maintainers of Perl's infrastructure to get together and do whatever is necessary to keep that infrastructure running well and improve its services.
I arrived at PTS with a TODO list which I knew was already more than I would be able to complete. But PTS is not just about getting your own work done. A major benefit of having thirty perl hackers together in a room is that often when someone hits a problem or needs guidance or information they can simply wander over to the table where the author of the software they are using is sitting and ask them directly.
The major achievement in this Perl Toolchain Summit was to wrap up the separate major components together under a common umbrella (App::Benchmark::Perl::Formance::Supertool), so it is easier approachable when setting up a new environment or actually running and evaluating benchmarks.
This allows to create a whole overall performance history of Perl5 releases based on a current snapshot of CPAN. Tracking current blead performance is possible as well, though not actively exercised by me right now.
The overall vision can be found on my earlier YAPC::Europe slide decks:
For now, here is a current snapshot with preliminarynon-representative results taken with the benchmarks running in "fast mode", i.e., with much smaller datasets or iterations, and slightly disturbed with OS noise:
Write a program which prints out all anagrams for a given word. For more information about Anagram, please check this Wikipedia page.
I'm not sure I fully understand the question, but my understanding is that we are looking for existing words which are anagrams of each other. For example, "pots", "spot", "tops", and "post" are anagrams of each other because they have exactly the same letters rearranged in a different order.
Just as for last week second challenge, I will use a words.txt file containing 113,809 lower-case English words usually accepted for crossword puzzles and other word games. The words.txt file can be found on my Github repository. The original list was contributed to the public domain by Internet activist Grady Ward in the context of the Moby Project. This word list is also mirrored at Project Gutenberg.
When I read the definition of an anagram in Wikipedia, I knew I would need a combinatorics module. I first checked Math::Combinatorics and tried to generate all the anagrams using its next_permutation method. I could have used Algorithm::Combinatorics and its permutations, as well.
But there was a catch: if a letter is repeated in the input word, the anagrams won’t be unique. I didn’t want to reach for List::Util’s uniq as it needs to keep all the anagrams in memory while the iterator had much lower memory footprint. Fortunately,
I knew that “unique” means “hash” in Perl.
#!/usr/bin/perl
use warnings;
use strict;
use feature qw{ say };
use Math::Combinatorics;
my @letters = split //, shift;
my $iter = 'Math::Combinatorics'->new(data => \@letters);
my %seen;
$seen{$_}++ or say $_ while $_ = join '', $iter->next_permutation;
It's long past the time to stop thinking about hosting. It's archaic. It's not a proper way to deliver content any more. That's not what the cool kids are doing. The need for a third party sponsor went away long ago. Tying the possibility of success to a lightly interested corporate sponsor has never been that successful in the Perl community. We need to stop limiting efforts to those that want to participate in that way.
The Perl Toolchain Summit (PTS) is happening this week in Marlow, on the banks of the River Thames, in the UK. Most of the attendees will gather on Wednesday evening, with the real business kicking off at 9am on Thursday morning. For the next four days 32 Perl developers will be working intensively on the tools that all Perl developers rely on.
Attendees log their activities on the wiki, and blog posts will appear during and after. You can see some of what goes on in semi real-time on twitter, via the #pts2019 hashtag.
We're extremely grateful to MaxMind, who once again are a Gold Sponsor for the PTS. The attendees are brought together from around the world, and we're only able to do this with the support of companies from our community, like MaxMind.
I am planning on a new project, and a friend suggested me to look to Arango, as an alternative do Mongo, specially because it includes a graphs query language integrated. As I am not really used to Mongo at all, decided to give it a try.
Unfortunately I did not find a proper module to use Arango from Perl. Therefore I decided to start one from scratch. Probably not a great idea as my free time is likely non-existent. But nevertheless, I did it.
I am trying to abstract major entities (database, collection, document, cursor) in order to use them directly as proper objects in Perl, and at the same time, try to keep a low code profile, delegating most options directly to Arango REST interface. In order not to be too relaxed, I am using JSON::Schema::Fit to validate the parameters sent to Arango API.
Language specification of SPVM 1.0 is described in this document. SPVM is in beta testing for the 1.0 release. Language specifications are subject to change without notice.
The Perl Toolchain Summit (PTS) is taking place later this month in Marlow, in the UK, as previously announced. This event brings together maintainers of most of the key systems and tools in the CPAN ecosystem, giving them a dedicated 4 days to work together. In this post we describe how the attendees are selected, and how we decide what everyone will work on. We're also giving you a chance to let us know if there are things you'd like to see worked on.
This blog post is brought to you by cPanel, who we're happy to announce are a Platinum sponsor for the PTS. cPanel are a well-known user and supporter of Perl, and we're very grateful for their support. More about cPanel at the end of this article.
Create a script to generate 5-smooth numbers, whose prime divisors are less or equal to 5. They are also called Hamming/Regular/Ugly numbers. For more information, please check this wikipedia page.
Regular or 5-smooth numbers (or Hamming numbers) are numbers whose prime divisors are only 2, 3, and 5, so that they evenly divide some powers of 30.
A Perl 5 Solution
Generating just some 5-smooth numbers is a trivial problem. For example, if you want 6 such numbers, you only need to generate the first six powers of 2 (or the first six powers of 3, or six powers of 5), as in this Perl one-liner:
The saga goes on! This time we talk about enviles, a way to pass key/value pairs without polluting the environment while still keeping it dumb simple. Find the article here: Dibs - Envars Envisaged As Enviles and, as always, enjoy!