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
- Grepping multiples of 3 and 5
- Generating random integers
- Testing palindromic numbers
- Adding up even Fibonacci numbers
- Playing with Fibonacci numbers
- Distance between two points
- Playing with prime numbers
- Using map and Seq to compute the value of π
- Computing totals
- Sum of the numbers equal to the sum of factorials of digits
- Generating random passwords
- The joy of Unicode
- What’s the date today?
- How many days in the century match the condition?
- Another solution of the same prob- lem
- More on X, .., and …
- Reduction operator
- All the stars of Raku
- The EVAL routine
- The first test
- The second test
- Tips and ideas for the Raku Golf code
- What’s behind 0.1 + 0.2
Using Raku — 59 programs
- How to debug programs
- 1. Hello, World!
- 2. Greet a person
- 3. String length
- 5. Reverse a string
- 6. Removing blanks from a string
- 8. Incrementing filenames
- 9. Random passwords
- 11. Caesar cipher
- 12. Plural endings
- 19. π
- 20. Factorial!
- 21. Fibonacci numbers
- 22. Print squares
- 23. Powers of two
- 24. Odd and even numbers
- 25. Compare numbers approximately
- 27. Prime numbers
- 28. List of prime numbers
- 29. Prime factors
- 30. Reducing a fraction
- 31. Divide by zero
- 32. Generating random numbers
- 33. Neumann’s random generator
- 34. Histogram of random numbers
- 35. Distance between two points
- 39. Unicode digits
- 41. Binary to integer
- 42. Integer as binary, octal, and hex
- 43. Sum of digits
- 44. Bit counter
- 45. Compose the largest number
- 46. Convert to Roman numerals
- 48. Swap two values
- 49. Reverse a list
- 50. Rotate a list
- 51. Randomise an array
- 52. Incrementing array elements
- 53. Adding up two arrays
- 55. Sum of the elements of an array
- 56. Average of an array
- 58. Is an element in a list?
- 59. First odd number
- 62. Finding unique elements
- 63. Minimum and maximum
- 64. Increasing sequences
- 65. Passing arrays to subroutines
- 66. Variadic parameters in a sub
- 70. Product table
- 71. Pascal triangle
- 72. Count vowels in a word
- 76. Double each character
- 77. Remove duplicated words
- 80. Increase digits by one
- 86. Basic calculator
- 87. Current date and time
- 88. Formatted date
- 89. Datetime arithmetic
- 90. Leap years
Creating a Compiler in Raku — 6 programs
Perl 6 Calendar 2019 — 11 programs
Perl 6 at a Glance — 51 programs
- Hello, World!
- Sigils
- Introspection
- Frequently used special variables
- Typed variables
- Bool
- Int
- Str
- Array
- !, not
- ?, so
- Postfixes
- Method postfixes
- div, mod
- +<, +>
- String operators
- lt, gt, le, ge
- Universal comparison operators
- before, after
- List operators
- |, &, ^
- Shortcut operators
- min, max
- :
- Negation
- Reverse operator
- Reduction
- Cross-operators
- Zip meta-operators
- Hyper-operators
- Subroutines, or subs
- Non-value argument passing
- Optional parameters
- Default values
- Slurpy parameters and flattening
- Nested subs
- Anonymous subs
- Lexical variables
- Dynamic variables
- Anonymous code blocks
- Placeholders
- Function overloading
- Class methods
- Multiple inheritance
- Private (closed) methods
- Submethods
- Constructors
- The $/ object
- Actions
- Unicode
- Whatever (*)