2. Your first Spec

A spec is a file that contains your rules and the data they depend on. It starts with a name, followed by data declarations for the inputs and rule declarations for the logic.

The editor below has a working spec. Open the Consult tab to send data in and see the rules evaluate in real time.

How it works

Each rule starts with a default value. The unless clauses are evaluated in order from top to bottom. The last matching clause wins.

data declares the inputs. The type after the colon (text, scale, …) tells Lemma what shape of value to expect. Lines starting with -> add constraints (allowed strings, numeric bounds, units). You'll see more in Securing Your Spec.

Publishing

When your spec is ready, publish it. Publishing creates a snapshot with a version number. Published specs are queryable over HTTP. You can call them from any language or tool.

If you're on LemmaBase.com, the publish button is in the toolbar. If you're using the CLI:

lemma publish weather_advice.lemma