📘 Cross-product operator X in Perl 6

X is the cross product operator, which converts the two given lists to a third one containing all the possible combinations of the elements from the original lists. @c = @a X @b; This is the same as the following sequence: @c = ((@a[0], @b[0]), (@a[0], @b[1]), (@a[0], @b[2]), … (@a[N], @b[0]), (@a[N], @b[1]), … … Continue reading “📘 Cross-product operator X in Perl 6”

📘 Cross meta-operator X in Perl 6

The cross meta-operator prefix, X, applies an operation to all the possible combinations of the elements of the operands that are treated in list context. The result of the cross-operation is also a list. Here is an example that prints the coordinates for all the cells of a chess board: say ‘a’..’h’ X~ 1..8;

📘 Building the product table using Perl 6

Generate and print the product table for the values from 1 to 10. The task does not say anything about how to format the output. First, let us print the results as a list with one line per one multiplication. In Perl 6, there is a cross operator X, which operates over lists and creates a … Continue reading “📘 Building the product table using Perl 6”

📘 Generating a histogram of random numbers using Perl 6

Test the quality of the random generator by using a histogram to visualise the distribution. The quality of the built-in generator of random numbers fully depends on the algorithm the developers of the compiler used. As a user, you cannot do much to change the existing generator, but you can always test if it delivers … Continue reading “📘 Generating a histogram of random numbers using Perl 6”

💡 102. Insertion sort in Perl 6

Today, we are investigating the Insertion sort algorithm and its possible implementation in Perl 6. The algorithm’s complexity is O(n2), but it is a good candidate to practice some Perl 6. The idea is simple. You find the minimum value in the array and put it to the first position. Then you scan the data … Continue reading “💡 102. Insertion sort in Perl 6”

💡 100. Bubble sort in Perl 6

Hey everyone, let’s implement some algorithms in Perl 6. The first one will be the classical Bubble sort. In essence, you scan the data from left to right and swap the two adjacent items if they are not ordered properly yet. Repeat until the whole data list is ordered. Here’s the initial straightforward implementation: sub … Continue reading “💡 100. Bubble sort in Perl 6”

🎄 9/25. More on X, .., and … in Perl 6

Welcome to Day 9 of the Perl 6 One-Liner Advent Calendar! On Day 6, we had a construct with a cross-operator, (999…100) X* (999…100). Today, we’ll dive into a similar construction from November: 1..10 X* 1..10 It prints the items of the product table for the numbers from 1 to 10: (1 2 3 4 … Continue reading “🎄 9/25. More on X, .., and … in Perl 6”

🎄 7/25. The joy of Unicode in Perl 6

Welcome to Day 7 of the Perl 6 One-Liner Advent Calendar! Today, we’ll look at the month of March in the Perl 6 Calendar 2019: The code here is using three characters outside of the ASCII land. We can even add one more: say π × $𝜌² In Perl 6, you can freely use Unicode … Continue reading “🎄 7/25. The joy of Unicode in Perl 6”

🎄 6/25. Testing palindromic numbers in Perl 6

Welcome to Day 6 of the Perl 6 One-Liner Advent Calendar! As promised yesterday, today we’ll be solving problem 4 of Project Euler. Let me once again remind you that you can pause reading and solve the problem yourself first. My intention is to demonstrate the beauty of Perl 6 and Perl in general. So, … Continue reading “🎄 6/25. Testing palindromic numbers in Perl 6”

Perl 6 at a Glance

This book is about Perl 6, a programming language of the Perl family. It covers many basic and in-depth topics of the language and provides the initial knowledge you need to start working with Perl 6. The book does not require any previous experience with Perl, although some general understanding of programming is assumed. Andrew … Continue reading “Perl 6 at a Glance”

Interview with Carl Mäsak

Carl Mäsak is an application developer for Perl 6. He is the number one Perl 6 bug reporter, the author of November, one of the first real web applications written in Perl 6. October You started following the Perl 6 development in 2003–2004, a few years after the Perl 6 project was announced. What was … Continue reading “Interview with Carl Mäsak”

Interview with Stevan Little

Stevan Little is the author of Moose, the library introducing Perl 6-inspired classes in Perl 5. He also started the p5-mop project, which was aimed to bring classes to the Perl 5’s core. Perl and OOP Once you said that it was Damian Conway’s “Object Oriented Perl” book, which gave you the idea of real … Continue reading “Interview with Stevan Little”

Interview with Audrey Tang

The questions and answers in this document are CC0 and in the public domain. Audrey Tang first of all is known as the creator and developer of Pugs, the Perl 6 User’s Golfing System, an implementation of Perl 6 in Haskell, which started on 1 February 2005 and was the most actively developing and the most complete … Continue reading “Interview with Audrey Tang”