Raku Books

Tested programs

Every complete Raku program in these books is compiled and run at build time under two compilers — Rakudo (the reference implementation) and Raku++ (the engine that runs code in your browser via Raku.js). A program gets a Run button only when it runs under Rakudo and Raku++ reproduces the same output. Of 1341 Raku programs across the books: 349 run in the browser, 908 are illustrative fragments (no Run button), 29 need a local environment (files or the command line), 28 use concurrency the single-threaded in-browser engine can’t run, and 27 are valid programs the in-browser engine cannot run correctly yet.

Programs that need a local environment

These are complete, valid Raku programs, but they read the filesystem, spawn processes, or use the command line — things the sandboxed in-browser engine has no access to. They run fine on your own computer.

Program Book Why
Renaming files Raku One-Liners reads the local environment
Merging files horizontally Raku One-Liners reads the local environment
Reversing a file Raku One-Liners reads the local environment
All the stars of Raku Raku One-Liners reads the local environment
18. Finding duplicate texts Using Raku reads the local environment
92. Sleep Sort Using Raku reads the local environment
94. Parallel file processing Using Raku reads the local environment
95. The cat utility Using Raku reads the local environment
97. Reading directory content Using Raku reads the local environment
Creating a Simple Translator Creating a Compiler in Raku reads the local environment
Grammar Creating a Compiler in Raku reads the local environment
Test runner Creating a Compiler in Raku reads the local environment
Twigils Perl 6 at a Glance reads the local environment
Frequently used special variables Perl 6 at a Glance reads the local environment
An example Perl 6 at a Glance reads the local environment
Files Perl 6 at a Glance reads the local environment

Programs that use concurrency

These use promises or threads. The in-browser engine (Raku.js) is single-threaded, so real parallelism deadlocks — run these on your own computer.

Program Book Why
14. The longest common substring Using Raku uses concurrency (promises/threads)
17. The longest palindrome Using Raku uses concurrency (promises/threads)
91. Setting timeouts Using Raku uses concurrency (promises/threads)
April Perl 6 Calendar 2019 uses concurrency (promises/threads)
Read and write Perl 6 at a Glance uses concurrency (promises/threads)
The list method Perl 6 at a Glance uses concurrency (promises/threads)
Beyond scalars Perl 6 at a Glance uses concurrency (promises/threads)
The closed method Perl 6 at a Glance uses concurrency (promises/threads)
Basics Perl 6 at a Glance uses concurrency (promises/threads)
start Perl 6 at a Glance uses concurrency (promises/threads)
in and at Perl 6 at a Glance uses concurrency (promises/threads)
anyof and allof Perl 6 at a Glance uses concurrency (promises/threads)

Programs the in-browser engine can’t run yet

These are complete, valid Raku programs, but Raku++ errors or prints something different from Rakudo — a gap to close in the browser engine. Each page still shows the program’s expected output.

Program Book Why
All the stars of Raku Raku One-Liners Raku++ output differs
The second test Raku One-Liners Raku++ output differs
10. DNA-to-RNA transcription Using Raku Raku++ output differs
32. Generating random numbers Using Raku Raku++ output differs
36. Standard deviation Using Raku Raku++ output differs
38. Monte Carlo method Using Raku Raku++ error (non-deterministic)
78. Separate digits and letters Using Raku Raku++ output differs
81. Pig Latin Using Raku Raku++ output differs
82. Simple string compressor Using Raku Raku++ output differs
84. Decode Roman numerals Using Raku Raku++ output differs
86. Basic calculator Using Raku Raku++ output differs
!, not Perl 6 at a Glance Raku++ output differs
Method postfixes Perl 6 at a Glance Raku++ output differs
before, after Perl 6 at a Glance Raku++ output differs
Modules Perl 6 at a Glance Raku++ output differs
Private (closed) methods Perl 6 at a Glance Raku++ output differs
Unicode Perl 6 at a Glance Raku++ output differs

Verified-runnable programs

Raku One-Liners — 23 programs
Using Raku — 59 programs
Creating a Compiler in Raku — 6 programs
Perl 6 Calendar 2019 — 11 programs
Perl 6 at a Glance — 51 programs