Tutorial

Learn Axioma by running it

A short, hands-on tour — from a variable binding to a recursive logic rule. Every example below runs right here in the page.

▶ Edit any example and press Run — or /Ctrl+Enter. Same WebAssembly interpreter as the playground; nothing leaves your browser. interpreter: loading…
LESSON 1

Trace a value — the period

The most distinctive move in everyday Axioma: end a line with a period and it traces the value — prints it, no function call at all. Both halves are inspired by older languages: printing a value with a dot by Forth (where ., "dot", pops and prints the top of the stack), and ending a statement with a dot by Prolog (where every clause closes with .). Axioma's . does both at once — it shows a value and terminates the statement. (A trace shows the value as the language sees it, so a string keeps its quotes; println is the more familiar way to write clean output for a person.)

trace.axOpen in Playground ↗

Because the dot terminates a statement, several can share one line — and the playground traces the last line for you automatically, which is the you'll see in every example. (A dot directly before a digit is still a decimal point, so 3.14 is a number, not a trace.)

oneline.axOpen in Playground ↗
LESSON 2

Bindings — REBOL's set-word colon

Axioma binds a name to a value with a colon: name: value — no let, no var. The colon-binding is inspired by REBOL (Carl Sassenrath, 1997), where word: is an atomic set-word — the colon is fused onto the word itself. Axioma adopts that look but treats : as an ordinary binding operator (its own token), so even x : 5 — with a space — still binds. (REBOL itself drew on Lisp, Forth, Logo and Self; the set-word notation is its own — Algol and Smalltalk used :=, Logo used make.)

: creates a binding; = reassigns an existing one — and the difference is enforced. Use = on a name you never declared and Axioma stops you, telling you to declare it with : first. Comparison for equality is a third thing again: ==.

You can also bind several names at once, left-to-right.

bindings.axOpen in Playground ↗
LESSON 3

Blocks — the versatile [ ]

Square brackets are the most versatile punctuation in Axioma. At heart, [ ] is a block — a sequence of steps whose value is its last expression. That single idea powers a remarkable range of the language:

How does Axioma tell an array from a block? By context and content. In a body — a function or a control-flow branch — the brackets are always a block, yielding the last value (so if … then ["big"] else ["small"] gives the string "big", not a one-element array). Standing on their own, brackets of bare values are an array, while brackets that contain statements — like the bindings below — are a value-block.

value-block.axOpen in Playground ↗

That same block is the body of control flow — a loop runs a block per iteration, and an if (an expression) hands back the value of whichever branch it takes:

bodies.axOpen in Playground ↗
LESSON 4

Functions

A function is just a value — you bind it with : like anything else, and its body is a [ ] block. Call it with parentheses.

square.axOpen in Playground ↗

There's an optional named form, and a lightweight lambda … => for short functions:

forms.axOpen in Playground ↗

Functions can call themselves (recursion), and can return other functions that capture their surrounding scope (closures):

recursion.axOpen in Playground ↗
closure.axOpen in Playground ↗
LESSON 5

Composition — functions over collections

Functions are first-class, so you pass them around. map applies one to every item; filter keeps what matches; reduce folds a collection to a single value.

And because a function is a value, you can compose small ones into a pipeline:

compose.axOpen in Playground ↗
LESSON 6

Sets & comprehensions

Sets are first-class, and set-builder notation comes straight off the page. Read { n | n <- xs, cond } as “the set of n drawn from xs such that cond.” (mod is the word form of %.)

comprehension.axOpen in Playground ↗

The full algebra of sets is there too — union , intersection , difference \:

setops.axOpen in Playground ↗
LESSON 7

Quantifiers — logic that evaluates

The universal and existential quantifiers range over a set and evaluate to a truth value. Write them as words…

quantifiers.axOpen in Playground ↗

…or as the symbols mathematicians actually write — the same AST either way:

glyphs.axOpen in Playground ↗
LESSON 8

Logic & rules

Declare a relation, assert some facts, and write rules with <== (“holds when”). Rules can be recursive — here the engine computes the full transitive closure of a graph, Datalog-style, iterating to a fixpoint.

paths.axOpen in Playground ↗
LESSON 9

Concepts & the copula is

A concept is a class. Subclass with extends, make an instance with the indefinite article a (or an), and classify with Russell's copula is — which Axioma keeps precise: membership () for an instance, and class-inclusion () between two concepts.

concepts.axOpen in Playground ↗
LESSON 10

Beyond true and false

Real knowledge is sometimes missing and sometimes contradictory. Axioma builds that in: Belnap's four-valued logic has a value for “asserted and denied” (⊤⊥), and Kleene's three-valued logic handles the unknown (om) without collapsing.

truth.axOpen in Playground ↗

That's the core.

You've met bindings, blocks, functions, sets, logic, concepts and many-valued truth — enough to read most Axioma. Take any example into the full playground and keep going.

The full Axioma Manual and textbook are coming to the site — this tutorial is the slimmed-down tour.