PatLang Use Cases
The Paradigms Guide covers each capability in isolation. Real PatLang programs usually combine several at once — this page walks the repository's larger example programs by the problem shape they're actually solving, with a note on which paradigms each one leans on and a link to the corresponding interactive portfolio demo where one exists.
Point of sale
Paradigms: events, OO, logic. A checkout session is modelled as a stream of scan/pay events; the product catalogue is a set of objects created with new/set_var; a dairy discount is expressed as a logic-programming rule rather than an if chain buried in the checkout function. Reach for this shape when a system's behaviour is naturally driven by discrete external occurrences arriving over time, and some of its business rules read more clearly as declarative facts than as procedural branches. See PatLang Point of Sale Demo.
Maze solving
Paradigms: logic, goal-oriented search, events. The maze's connectivity is asserted once as open facts; a goal-oriented query searches that fact store for a path; solved/unsolved events report the outcome. Reach for this shape when the core of the problem is "does a path exist between these states, given these connections" — logic and goal search are a much closer fit than hand-rolled graph traversal code. See PatLang Maze.
Project report simulation
Paradigms: OO, logic, events, goal-oriented. Workers are objects with roles; task dependencies are resolved goal-oriented, gated by QA-review stages that can send work back for rework; a virtual clock drives an event log suitable for animated timeline replay. Reach for this shape when you're modelling a process with roles, dependencies, and feedback loops, and want the simulation's own event log to double as its explanation. See PatLang Project Report Writer.
Ollama chat client
Paradigms: raw networking. Built directly on the networking host chunk's TCP primitives with hand-rolled HTTP/1.1 framing (including chunked-response handling) rather than a library — a deliberate demonstration that PatLang has no networking dependency below the socket layer. Reach for this shape when you want a client with no external dependencies and full control over the wire protocol, or when you're specifically testing PatLang's raw-socket primitives.
Live playground / IDE
Paradigms: self-hosting, WASM. The playground compiles the self-hosted lexer/parser/lowerer/codegen to WebAssembly and runs entered source through it live in the browser, in run/tokens/AST modes — the same self-hosted pipeline that compiles ordinary PatLang programs, running inside the browser sandbox rather than as a native binary. Reach for this shape when you want an in-browser, no-install way to demonstrate or experiment with the language itself. See PatLang Live Playground and PatLang IDE.
Map-reduce style parallel work
Paradigms: concurrency (real OS threads). parallel_map(items, "func_name") spawns one real thread per item via std::thread::scope, verified against a genuine wall-clock speedup, not simulated. Reach for this shape when a batch of independent items of work would actually benefit from running concurrently — not for I/O-bound coordination, which fibers fit better. See PatLang Real OS Threads, and contrast with PatLang Fibers for the cooperative, non-parallel alternative.
Contract-checked numeric code
Paradigms: contracts, numeric tower. Functions whose correctness depends on caller-supplied invariants — division, financial rounding, anything where the exact-Rational promotion rule matters — pair naturally with require/ensure at the boundary rather than defensive checks scattered through the body. See PatLang Design by Contract and PatLang Numeric Tower.
A compiler that compiles itself
Paradigms: self-hosting. Beyond being a demonstration, this is genuinely how PatLang programs get compiled day to day: patc1.exe, the self-hosted compiler, is the ordinary tool for ordinary compiles (see the PatLang repository's own CLAUDE.md conventions). Reach for this pattern generally when you want a language's own tooling to double as proof that the language is expressive enough to build real software, not just toy examples. See PatLang Compiler Self-Metrics and PatLang Self-Timing Benchmark.
See also
- Paradigms Guide — each capability used above, on its own.
- Idioms & Patterns — the recurring patterns inside these programs.
- PatLang Portfolio — the full interactive demo index.