Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Reasoning

A store that only holds the facts you put in it is a database. Argon derives new facts from stored ones, answers questions over both, and changes stored state — all through one atom, the rule, which comes in five modes. The modes form a ladder from pure computation to the single mode that writes:

  • fn — pure computation over its arguments, no state at all.
  • derive — defines a derived relation by a rule.
  • query — reads stored and derived facts, returns a typed value.
  • check — observes the state and emits diagnostics, writes nothing.
  • mutate — changes stored facts. The only writer.

derive and check are written in the Datalog register — :- reads “if”, a comma reads “and”. fn, query, and mutate use ordinary expression syntax. The reference fixes the exact grammar of all five in the rule atom.