Switch to dark mode
Switch to light mode

Learn Lemma

Lemma evaluates your rules deterministically, every time, and can show why. This guide explains all of the features the language has to offer.

1. Getting started

Start with Getting started. It walks you through installing Lemma, writing your first Spec, and evaluating it from the CLI.

2. Specs, Data, and Rules

Specs, Data, and Rules explains how a Spec is structured. You learn about open inputs, constraints, and how Rules reference each other.

3. Conditional logic

Conditional logic covers Unless chains and boolean literals, which is how a Rule chooses between outcomes.

4. Types and units

Types and units is the widest chapter. It covers literals, operators, the stdlib units, conversions, ranges, and dates, and it introduces Veto.

5. Extending Data

Extending Data shows how to build on parent types, apply Data commands, and reuse definitions across Specs.

6. Composing Specs

Composing Specs brings everything together with Uses, temporal versions, planning checks, repositories, and the registry.

7. Lists

Lists covers value lists and instance lists, keys and find, list commands such as sum and where, lists of a Spec's own rows, and how lists travel in evaluation data and results.

8. Numeric precision

Numeric precision closes the guide by explaining exact rational arithmetic and how clients should parse the numbers Lemma returns.

Language reference

For exhaustive syntax, operators, and Data commands, see the Language reference.