Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

Complete programs, not fragments. Each one lives in examples/ with a recorded output in tests/golden/, which enrolls it in the example gate: every CI run compiles it on both backends and diffs what it prints. A program listed here works, or the build is red.

ProgramWhat it exercises
grep_clone.rkCLI flags, file reads, catch on the error branch, string scanning
file_copy.rkError enums with message(), optionals, own at a call site
game_loop.rkFrame update, interfaces, worker threads. Read it for the loop, not the storage (see below)
text_editor.rkUndo stack, ensure cleanup, linear resources. Same storage caveat
parameter_modes.rkBorrow, mutate, take. The subject of Passing Values

Run one:

rask run examples/grep_clone.rk -- -n pattern file.txt

There were walkthrough chapters here. They quoted code by hand, were checked only for parsing, and drifted: the game-loop page taught Pool<T>, which the design replaced with racks and links. Guide chapters now pull their code out of these programs (how this book is built), so a walkthrough can’t say something the program doesn’t do.