A couple of syntax sweets in Raku

When working on preparing data for the covid.observer site, I discovered a couple of interesting findings, which I did not notice earlier or did not pay much attention to it. Scanning two arrays together The first construct allows us to scan two different arrays in a single loop. For example, let’s print a table with … Continue reading “A couple of syntax sweets in Raku”

My books on GitHub

Before the GitHub 02/02/2020 Archive program, I uploaded all my books published by DeepText to github.com/ash/books. I hope it will be frozen and archived for the future generations :-D. It’s all in PDFs currently and can be downloaded freely. The Perl 6 Deep Dive cannot be in the open repository, as it was published by … Continue reading “My books on GitHub”

🦋 Calling C++ and Fortran functions from Raku using the NativeCall interface

Some time ago, I published an article about using NativeCall in Raku to call functions written in C. Today, let’s see how you can call simple functions written in C++ or in Fortran. There will be three examples for both languages: A function printing a message A function returning a number A function taking an … Continue reading “🦋 Calling C++ and Fortran functions from Raku using the NativeCall interface”

Implementing a stack-based language in Raku

I assume there is no need to tell what a stack is, and a stack-based programming is something that uses the stack to perform all the operation. The program flow in such a language resembles a reversed Polish notation, when you first list the operands, and then the operation: 40 2 + There are a … Continue reading “Implementing a stack-based language in Raku”

Raku at a Glance — A Language a Day, Advent Calendar 2019 Day 11/24

About this ‘A Language a Day’ Advent Calendar 2019 Welcome to Day 11 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the Raku programming language. Facts about the language A re-thinking of Perl Gradual type system Multi-paradigm: object-oriented, functional Allows concurrent computing Announced in 2000, implemented in 2015 Renamed from … Continue reading “Raku at a Glance — A Language a Day, Advent Calendar 2019 Day 11/24”

The Raku stand at FOSDEM 2020

A few weeks ago, I submitted a booth request for promoting the Raku programming language at the next year’s FOSDEM in Brussels (1–2 February 2020). Just got a confirmation that the stand is accepted. More details of whether it is a 2-day stand or it is only there on Saturday or on Sunday, and where … Continue reading “The Raku stand at FOSDEM 2020”

Concurrent atomic operations in C++ and Raku

Here’s a problem to solve: you have two threads, each incrementing the same single counter N times. What is the state of the counter at the end of the program? A straightforward solution A naïve C++ program can be written using the standard library threads like this: #include <iostream> #include <thread> int counter; void f() {     for (int c = 0; c != 100000; c++) counter++; } int main() {     std::thread thread_a {f}; … Continue reading “Concurrent atomic operations in C++ and Raku”

Raku One-Liners — a free book

Let me announce the new book, Raku One-Liners. The book is available in the PDF format for free. Later, paper copies will also be available. Download the Raku One-Liners book now N.B. As of today, the book is in the test mode, and a few updated PDF versions will be uploaded in a few days. … Continue reading “Raku One-Liners — a free book”

🦋 110. is rw vs is raw in Raku

The cryptic title should not stop you from seeing bits of the regular Raku code. Namely, the two traits that you can add to function arguments: is rw and is raw. These two traits may look confusing because both allow changing the passed variable: sub f1($x is rw) {     say $x; } sub f2($x is raw) {     say $x; } my $a = 42; f1($a); # 42 f2($a); … Continue reading “🦋 110. is rw vs is raw in Raku”