Small recipes, warm from the oven.
Short, complete programs for everyday tasks. Copy one, run it, change it.
Basics
3 recipesRead command-line arguments
Match on env.args() to build a tiny command.
pooka/envParse a number safely
Turn text into an Int without crashing on bad input.
pooka/intResultMatch on the shape of a list
Empty, one, many: let patterns do the counting.
matchStrings and text
3 recipesCount words in a file
Read a file, split it into words and print the most common ones.
pooka/filepooka/dictSplit, trim and join
The everyday string toolkit, in one pipeline.
pooka/stringWrite a tiny lexer
Generate a typed lexer from a TOML description with lexie.
lexieCollections
3 recipesCount things with a Dict
Tally values with upsert, then read them back sorted.
pooka/dictSort by a key
Order classes by any field with list.sort_by.
pooka/listpooka/orderFold a list into a summary
One pass, many answers: totals, minimums and counts.
list.foldFiles and processes
3 recipesRead and write files
Load, change and save a file, handling every FileError.
pooka/fileList a directory
Walk a folder and keep only the files you want.
pooka/filepooka/pathRun a shell command
Call another program and read its output and exit status.
pooka/processActors and concurrency
3 recipesA counter actor
Keep changing state safely inside an actor's mailbox.
actorbeFan work out to actors
Start several workers and gather their answers.
actorSupervise a worker
Restart a crashed process with pooka/otp.
pooka/otpInterop
3 recipesCall an Erlang function
Describe it once in an external block, call it like Pooka.
externalUse an Elixir or Gleam package
Add it from Hex and give it a typed front door.
pooka addServe HTTP with Cowboy
A small web server in a page of Pooka.
cowboyTesting
2 recipesWrite your first test
test blocks, assert and pooka test.
testassertTest many cases in a loop
Table-driven tests with loop and labelled assertions.
loopassert … as
No recipe for that yet. Ask for one, or write it yourself.
Have a recipe to share?
A recipe is one Markdown file in src/cookbook/ with one complete program that compiles with the current release. Send it as a pull request.