📘 Printing a list of prime numbers using Perl 6

Print thelist of the first ten prime numbers. In Task 27, Prime numbers, we’ve seen how to check if the given number is prime. To print the list of the first ten numbers, organize a lazy list.The code is quite compact and Perlish by nature: my @numbers = grep {.is-prime}, 1..*;say @numbers[^10]; The first line has to … Continue reading “📘 Printing a list of prime numbers using Perl 6”

📘 Testing prime numbers using Perl 6

Decide if the given number is a prime number. Prime numbers are those that can be divided only by 1, and by themselves. Perl 6 provides built-in support, using the is-primeroutine, for checking if the number is prime. There are two ways of using it. First, as a built-in function: say ‘Prime’ if is-prime(17); Second, as a … Continue reading “📘 Testing prime numbers using Perl 6”

🎄 17/25. Playing with prime numbers in Perl 6

Welcome to Day 17 of the Perl 6 One-Liner Advent Calendar! Today, we’ll have two one-liners, both generating some prime numbers. Part 1 First, let us solve Problem 7 of Project Euler, where you need to print the 10001st number (having the first being 2). Perl 6 is good at prime numbers, as it has … Continue reading “🎄 17/25. Playing with prime numbers in Perl 6”

📘 Finding prime factors using Perl 6

Find the prime factors of a given number. Prime factors are the prime numbers that divide the given integer number exactly. In Task 28, List of prime numbers, we’ve seen how to make a lazily evaluated list of prime numbers. This list is used in the program as a generator of the factor numbers for the … Continue reading “📘 Finding prime factors using Perl 6”

Using Perl 6

There is a new version of this book. If you want to get an electronic copy or a paperback, see Using Raku for more details. 100 Programming Challenges Solved with the Perl 6 Programming Language This book is a collection of different programming challenges and solutions in Perl 6. It can be used as an … Continue reading “Using Perl 6”

🎄 26/25. Overview of the Perl 6 One-Liner Advent Calendar 2018

The Perl 6 One-Liner Advent Calendar 2018 is over! Let’s make a quick overview of what we have covered so far. There were a few themes covered. First, some one-liners from the Perl 6 Calendar 2019 were explained in more detail. We looked at how to generate random passwords and random integers, how to print … Continue reading “🎄 26/25. Overview of the Perl 6 One-Liner Advent Calendar 2018”

Contents

The posts on this site are grouped into a few series. There is also a free Perl 6 book published as a series of blog posts. Books 📘 Raku One-Liners — The new book about using the expressive power of the Raku language to create short and useful programs. Free PDF. 📘 Using Raku — The second … Continue reading “Contents”

Raku challenges — Index

Here, you find all links to the blog posts with explanations to my solutions of the Perl Weekly Challenges written in the Raku programming language. The source codes are available on GitHub in the raku-challenges repository. Browse the category ‘Raku challenges’ to see all articles about this. Use the table below to navigate directly to … Continue reading “Raku challenges — Index”

📘 Int type in Perl 6

The Int type is intended to host integer variables of arbitrary size. For example, no digit is lost in the following assignment: my Int $x =     12389147319583948275874801735817503285431532; say $x; A special syntax exists for defining integers with an other-than-10 base: say :16<D0CF11E0> Also, it is allowable to use the underscore character to separate digits … Continue reading “📘 Int type in Perl 6”

🔬29. Exploring the Int type in Perl 6, part 2

Today, the journey to the internals of Int continues and first let’s make a deep dive into one on of the fascinating methods, is-prime. If you never used it, this is a great method that implements the logic, which is usually not built-in in a programming language. It is also great because primality is an … Continue reading “🔬29. Exploring the Int type in Perl 6, part 2”

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”