Appendices: Projects, Interview Questions, Cheat Sheet & Resources

Capstone projects, interview questions, a Raku cheat sheet, Raku for developers coming from other languages, and resources with a study plan.

Appendix A: Capstone Projects

Beginner: Word Frequency Analyzer. MAIN with options, .IO.lines, comb, Bags, sorted reports, Unicode-correct counting.

Beginner: Unit Converter. Multi-dispatch on units, subsets for validation, enums, a REPL loop with prompt.

Intermediate: INI/Config Parser. A grammar with sections, comments, and key-value pairs, plus actions building a nested Hash, and tests.

Intermediate: Library Management System. Classes and roles (Borrowable, Serializable), custom exceptions, JSON persistence, a CLI with multi MAIN.

Intermediate: Log Monitor. IO.watch / Proc::Async (tail -f) feeding Supplies, regex parsing, alert thresholds with react/whenever, periodic summaries.

Intermediate: Concurrent Web Crawler. Cro::HTTP::Client, a Channel-based work queue, worker Promises, rate limiting with throttle, link extraction.

Advanced: Expression Language Interpreter. A grammar for a small language (variables, functions, conditionals), an AST with action classes, an evaluator with scopes, a REPL, and error reporting.

Advanced: REST API with Cro + Red. CRUD resources, JWT authentication middleware, validation with subsets, WebSocket notifications, Docker deployment, and tests.

Advanced: Markdown-to-HTML Converter. A grammar for a Markdown subset, actions producing HTML, a test suite with golden files.

Advanced: NativeCall Binding. Bind a C library (e.g., libsodium or zlib) with structs and callbacks, an idiomatic Raku API, and a zef distribution.

Data Science: CSV Analytics Tool. Text::CSV input, hyper-parallel aggregation, statistics, and Inline::Python for plotting.

Open Source: Publish a Module. Create a distribution with mi6, with docs, tests, CI, and publish with fez.

Appendix B: Interview Questions

What is Raku, and how does it relate to Perl?

Explain sigils ($ @ % &) and twigils ($! $. $* $? $^).

What's the difference between say, put, and print?

Why does 0.1 + 0.2 == 0.3 return True in Raku? What are Rat, Num, and FatRat?

What is given/when? What does with/without do?

Explain the ... sequence operator and lazy lists.

What are Pairs, and what is colon-pair syntax (:name<value>, :$var, :!flag)?

Sets, Bags, and Mixes: when do you use each?

What is NFG, and why does "👨‍👩‍👧".chars return 1?

Assignment = vs binding :=?

Functions and Types Explain parameter kinds: positional, optional, named, slurpy (*@, **@, +@), is copy, is rw.

What is multiple dispatch? How are candidates ordered? What is proto?

What are WhateverCode (* + 1) and placeholder variables ($^a)?

Explain the meta-operators [op], »op«, X, Z, R.

What are junctions, and what is autothreading?

How do you define custom operators, and what determines their precedence?

What are type objects, :D/:U smileys, subsets, and coercion types?

What are allomorphs (e.g., IntStr)?

Explain has $.x vs has $!x. What does is rw do on attributes?

What's the object construction order (new, bless, BUILD, TWEAK)? Why are BUILD and TWEAK submethods?

Roles vs classes vs inheritance? How are role conflicts resolved?

What are parametric roles? What does but do?

What does callsame/nextsame do?

What is the meta-object protocol? Give examples of .^methods, .^attributes, .^add_method.

Regexes and Grammars How do Raku regexes differ from PCRE (whitespace, quoting, <[ ]>)?

regex vs token vs rule?

What is longest-token matching (| vs ||)?

What are grammars? How do action classes and make/made work?

What do the % and %% separator modifiers do?

Errors, Concurrency and Ecosystem die vs fail? What is a Failure, and when does it throw?

How do CATCH blocks and when work? What does .resume do?

What are phasers? Give examples (ENTER, LEAVE, FIRST, LAST, PRE, POST, UNDO).

Promises vs Supplies vs Channels?

What does react/whenever do?

hyper vs race?

What are dynamic variables ($*)? How do they differ from lexical variables?

How do modules, use/need/require, and is export work?

What is META6.json? What are zef and fez?

How do you call C code from Raku? How do you use Perl 5 modules?

What is RakuAST, and what are 6.e preview features?

Generate the first 20 Fibonacci numbers with the sequence operator.

Write a multi-dispatch fizzbuzz using where clauses.

Parse key=value lines with a grammar into a Hash.

Write a class with a role and a custom exception, plus tests.

Find duplicates in a list using a Bag.

Process a large range in parallel and count primes with hyper.

Write a react block that prints a tick every second and stops after 5 or on Ctrl+C.

Define a postfix factorial operator !.

Appendix C: Raku Cheat Sheet

# ===== Variables =====
my $s = 'str'; my @a = 1, 2, 3; my %h = a => 1; my &f = { $_ * 2 }; constant C = 42;
my Int $n = 5; my Str:D $d = ''; my $x := $s; state $count = 0;

# ===== Output =====
say 'gist'; put 'Str'; print 'no newline'; note 'stderr'; dd $s; printf "%5.2f\n", π;

# ===== Strings =====
"interp $s {1 + 1}"; 'literal'; q:to/END/; ~ (concat); x (repeat); .chars .uc .lc .tc .flip
.substr(0, 3) .index('x') .contains('x') .split(',') .words .comb .lines .trim .subst(/a/, 'b', :g)

# ===== Collections =====
@a[0]; @a[*-1]; @a.elems; @a.push(4); @a.map(* * 2); @a.grep(* > 1); @a.sort; @a.join(',')
%h<a>; %h{'a'}; %h<a>:exists; %h<a>:delete; %h.kv; %h.keys; %h.values; %h.pairs
set <a b>; bag <a a b>; (1..10); ^5; (1, 1, * + * ... *)[^10]; gather { take 1 }

# ===== Control =====
if c { } elsif d { } else { }; unless c { }; given $x { when 1 { } when Int { } default { } }
with $v { } else { }; for @a -> $x { }; for %h.kv -> $k, $v { }; while c { }; loop { last }
repeat { } while c; say 'x' if c; my $r = c ?? 'a' !! 'b'; $v // 'default'

# ===== Functions =====
sub add(Int $a, Int $b = 0, *@rest, :$named, :$req! --> Int) { $a + $b }
multi f(0) { 1 }; multi f(Int $n where * > 
…
raku script.raku   raku -e 'say 1'   raku -c f.raku   raku --doc f.raku   raku --profile f.raku
zef install Module   zef test .   prove6 -l t   mi6 new My::Dist   fez upload

Appendix D: Raku for Other Developers

Print with newline %h<k> / %h{'k'} a if c else b -> $x { }, * + 1 class, role /(\d+)/, $1 /(\d+)/, $0 (0-based!) die/try + CATCH (given/when, removed) Key gotchas:

Perl devs: sigils don't change (@a[0]); captures start at $0; regex whitespace is insignificant; . is method call and ~ concatenates; else if is elsif; for loops use pointy blocks (for @a -> $x); there's no foreach.

Python devs: lists flatten in some contexts (@ vs $); 0.1 + 0.2 == 0.3 is True; integers are arbitrary precision; methods on literals (5.is-prime) are normal.

Everyone: identifiers can contain hyphens ($first-name), so put spaces around subtraction ($a - $b, not $a-$b).

Appendix E: Resources and Study Plan

raku.org, docs.raku.org (language reference, types, tutorials), rakudo.org (downloads), raku.land (modules), the Raku Guide (raku.guide), The Raku Advent Calendar (raku-advent.blog), Rakudo Weekly News

Raku Steering Council and the problem-solving repository on GitHub

*Think Perl 6* (Laurent Rosenfeld; free online), a beginner-friendly introduction *Learning Perl 6* (brian d foy) *Raku Fundamentals* (Moritz Lenz)

*Parsing with Perl 6 Regexes and Grammars* (Moritz Lenz) *Perl 6 Deep Dive* and *Using Perl 6* / *Raku One-Liners* (Andrew Shitov)

*Perl 6 Quick Syntax Reference* (J.J. Merelo) *Raku Recipes* (J.J. Merelo)

IRC/Matrix: #raku on Libera.Chat (bridged to Discord and Matrix), r/rakulang, Stack Overflow [raku], The Weekly Challenge (Raku solutions), The Raku Conference (online), London/German Perl & Raku Workshops, the Raku Discord 12-Week Study Plan

Setup, variables, sigils/twigils, numbers, strings and Unicode Operators, control flow, I/O and MAIN

Lists, hashes, sets/bags, sequences, containers Subs, signatures, blocks, Whatever, multi-dispatch

Functional style, meta-operators, junctions, custom operators

Type system, classes, construction, inheritance Roles, enums/subsets/coercion, traits and MOP Regexes, grammars, action classes

Exceptions, Failures, phasers, dynamic variables Promises, Supplies, Channels, hyper/race, processes

Modules, zef, I/O, dates, data formats, databases, Cro, NativeCall 49–55 + Capstone

Testing, Pod6, profiling, performance, metaprogramming, deployment

Final tip: Raku rewards curiosity. Start with say, signatures, and sequences; then master grammars, multi-dispatch, roles, and Supplies: they're what make Raku unique. Experiment in the REPL, browse docs.raku.org, and remember: *-Ofun*! 🦋