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:

  1. Introduction to Evaluation — main concepts, basic evaluation, recursion and control, free variables and nondeterminism. (start here)
  2. Patterns of Knowledge — querying space content, functions and unification, nested queries.
  3. Types and Metatypes — concrete, recursive and parametric types; metatypes and evaluation order; controlling pattern matching.
  4. Standard Library Overview — grounded functions, console output and debugging, nondeterministic results, working with spaces, control flow, operations over atoms.
  5. Using MeTTa from Python — running MeTTa in Python, parsing grounded atoms, embedding Python objects.

Go deeper