MeTTa Programming Language Primer
Draft — This content has not been approved for publication.
Learn MeTTa hands-on. A plain-language course that takes you from your first expression to querying knowledge, types, the standard library, and calling MeTTa from Python — no prior Hyperon experience needed.
How to run the examples. Every snippet below is real MeTTa you can execute. Try them in the metta-lang.dev Playground (or the wiki's own MeTTa Playground panel, where available), or in a local Hyperon Experimental REPL. A line starting with ! is evaluated and its result printed as a list — we show that result in a trailing ; comment, e.g. !(+ 2 3) ; [5].
Course outline
This course follows the official metta-lang.dev “Learn MeTTa” path:
- Introduction to Evaluation — main concepts, basic evaluation, recursion and control, free variables and nondeterminism. (start here)
- Patterns of Knowledge — querying space content, functions and unification, nested queries.
- Types and Metatypes — concrete, recursive and parametric types; metatypes and evaluation order; controlling pattern matching.
- Standard Library Overview — grounded functions, console output and debugging, nondeterministic results, working with spaces, control flow, operations over atoms.
- Using MeTTa from Python — running MeTTa in Python, parsing grounded atoms, embedding Python objects.
Go deeper
- Technical reference: MeTTa Deep Dive — operational semantics, the implementation stack, and the Space API.
- Reference implementation: Hyperon Experimental — the official Rust MeTTa runtime.
- More practice: the open iCog MeTTa training curriculum — graded challenges and projects.