Raku Challenge, Week 92, Issue 1

This week’s task has an interesting solution in Raku. So, here’s the task:

You are given two strings $A and $B. Write a script to check if the given strings are Isomorphic. Print 1 if they are otherwise 0.

This week’s task has an interesting solution in Raku. So, here’s the task:

You are given two strings $A and $B. Write a script to check if the given strings are Isomorphic. Print 1 if they are otherwise 0.

Advent of Code 2020 Day 18/25 in the Raku programming language

Today there’s a chance to demonstrate powerful features of Raku on the solution of Day 18 of this year’s Advent of Code. The task is to print the sum of a list of expressions with +, *, and parentheses, but the precedence of the operations is equal in the first part of the problem, and … Continue reading “Advent of Code 2020 Day 18/25 in the Raku programming language”

The second wave of Covid.observer

In this post, I am telling a story of how updating covid.observer became a bit problematic, and how one of the developers of the Rakudo compiler helped not only to remove the errors but also to speed up the whole system by 2x.

In this post, I am telling a story of how updating covid.observer became a bit problematic, and how one of the developers of the Rakudo compiler helped not only to remove the errors but also to speed up the whole system by 2x.

Advent of Code 2020 Day 12.1/25 in the Raku programming language

Here is my solution of the first part of Day 12 of this year’s Advent of Code. The point in this solution is that I use multi functions a lot. Well, actually, the whole logic of the program is based on the dispatching rules of the variants of a single multi function. We start with … Continue reading “Advent of Code 2020 Day 12.1/25 in the Raku programming language”

Advent of Code 2020 Day 9/25 in the Raku programming language

Day 9 of Advent of Code is here and the task is the following. Take a list of numbers and find the first one, which is not the sum of two of the 25 preceding numbers. my $window = 25; my @data = ‘input.txt’.IO.lines.map: *.Int; say @data[($window ..^ @data).first({ @data[$_] != any(@data[$_ – $window ..^ … Continue reading “Advent of Code 2020 Day 9/25 in the Raku programming language”

Advent of Code 2020 Day 8/25 in the Raku programming language

Here is Day 8 of Advent of Code 2020. Today, we are building a program to read an execute programs in the assembly language. Well, a very limited assembly with only three opcodes and one register, accumulator. nop +0 acc +1 jmp +4 acc +3 jmp -3 acc -99 acc +1 jmp -4 acc +6 … Continue reading “Advent of Code 2020 Day 8/25 in the Raku programming language”

Advent of Code 2020 Day 7/25 in the Raku programming language

Let’l look at Day 7 of this year’s Advent of Code. This day’s problem is about handling luggage at the airport. There are some rules like these: As you see, the rules dictate how you can put bags into other bags. The only characteristics of the bag is its colour. For example, if the bag … Continue reading “Advent of Code 2020 Day 7/25 in the Raku programming language”

Advent of Code 2020 Day 6/25 in the Raku programming language

The task of Day 6 is to count letters :-). Well, not that straightforward. There’s some input like this split into groups and lines: abc a b c ab ac We have to count how many times each letter enters in each group. Again, the original task is more storyline-type and you’d better read it … Continue reading “Advent of Code 2020 Day 6/25 in the Raku programming language”

Advent of Code 2020 Day 5/25 in the Raku programming language

On Day 5, they gave a task to find a seat number in a place. We have a list of occupied seats in a special form. Long story short, the rows and the seats within the row are encoded binary, but instead of 0 and 1, letters are used: F and B for rows and … Continue reading “Advent of Code 2020 Day 5/25 in the Raku programming language”

Advent of Code 2020 Day 4/25 in the Raku programming language

In Day 4 of the Advent of Code, we are checking the fields of the passports. For each passport, there are a few fields labelled with a three-letter codes: byr (Birth Year) iyr (Issue Year) eyr (Expiration Year) hgt (Height) hcl (Hair Color) ecl (Eye Color) pid (Passport ID) cid (Country ID) The full record for a single passport contains colon-separated pairs key:value: … Continue reading “Advent of Code 2020 Day 4/25 in the Raku programming language”

Advent of Code 2020 Day 3/25 in the Raku programming language

In Day 3, we have to walk through the forest that is mapped in the following way: ..##……. #…#…#.. .#….#..#. ..#.#…#.# .#…##..#. ..#.##….. .#.#.#….# This pattern is repeated horizontally as many times as needed. In a single step, we can make three moves cells and one row down. It is also OK to pass through … Continue reading “Advent of Code 2020 Day 3/25 in the Raku programming language”

Advent of Code 2020 Day 2/25 in the Raku programming language

Here is my Raku solution to the problem of Day 2 of this year’s Advent of Code. The problem is to check if the passwords satisfy the requirement which is mentioned before the password: The phrase 1-3 a means that the character a must appear one to three times in the password, not fewer nor … Continue reading “Advent of Code 2020 Day 2/25 in the Raku programming language”

Advent of Code 2020 Day 1/25 in the Raku programming language

OK, I solved a few days of the on-going this year’s Advent of Code, so maybe it is a good idea to document it a bit so that those who like Raku can look at it too. So, the problem of Day 1 is to take a long list of integers and find such two … Continue reading “Advent of Code 2020 Day 1/25 in the Raku programming language”

A problem solved in 22 programming languages

In this post I am demonstrating the solutions of a programming problem in 22 different languages: Raku, Python, C++, Perl, Ruby, Scala, C#, Dart, Julia, D, Lisp, C, JavaScript (Node.js), Java, Rust, Pascal, Go, Lua, Fortran, PHP, Kotlin, and Bash.

In this post I am demonstrating the solutions of a programming problem in 22 different languages: Raku, Python, C++, Perl, Ruby, Scala, C#, Dart, Julia, D, Lisp, C, JavaScript (Node.js), Java, Rust, Pascal, Go, Lua, Fortran, PHP, Kotlin, and Bash.

The Pearls of Raku, Issue 13: functional elements and recursive sum

In this issue, we’ll take a look at an interesting pattern of passing multiple arguments to a function and apply it to creating a recursive sum.

In this issue, we’ll take a look at an interesting pattern of passing multiple arguments to a function and apply it to creating a recursive sum.

The Pearls of Raku, Issue 12: all and any

In this issue we’ll briefly talk about practical cases where junctions are really handy — both in syntax and in making the program simpler. Examples of using all and any junctions, checking parameters of MAIN, using in subsets.

In this issue we’ll briefly talk about practical cases where junctions are really handy — both in syntax and in making the program simpler. Examples of using all and any junctions, checking parameters of MAIN, using in subsets.