Start here
Lion documentation
Everything Lion can do, organized by what you need right now: to learn, to get a job done, to look something up, or to understand why.
Lion is a small Lisp whose programs are JSON. It evaluates on Effect, edits as a graph, runs from the command line, and includes a Datalog-style logic database.
These docs follow the Diátaxis framework. There are four kinds of documentation, each written for a different need, and they are kept apart so each one can do its own job. Tutorials teach and how-to guides direct; both are practical. Reference and explanation inform; both are theoretical.
Learning-oriented
Tutorials
Lessons that build something real, one working step at a time.
Task-oriented
How-to guides
Directions for getting a specific job done.
- Run Lion from TypeScript
- Run programs from the command line
- Branch on a value's shape
- Transform lists
- Build and run code as data
- Query with conditions and computed values
- Use answers as values
- Sort, page, and check query answers
- Follow relationships of any length
- Find what is missing
- Say that something exists
- Summarize groups of facts
- Answer graph questions
- Enforce rules on your data
- Solve for values and prove rules
- Check every run of commands
- Prove that every command keeps a rule
- Verify protocols with symbolic invariants, BMC, liveness, rewriting, and SAT
- Govern ontologies, prevent join fanout, and enforce workflow policies
- Build Graph-as-Code apps and shareable public HTML UI artifacts
- Check the shape of data
- Take data apart
- Explain a result
- Save and load a logic database
- Add your own functions and algorithms
- Call JavaScript objects and methods
- Ask AI models with TypeSafe
Understanding-oriented
Explanation
Background, reasoning, and the design choices behind Lion.
Information-oriented
Reference
Exact descriptions of every form, function, and command.
Self-hosted in Lion
Where to start
- New to Lion? Take the tutorial Your first Lion program. It takes about ten minutes, and every step runs in your browser.
- Have a job to do? Pick a how-to guide, such as Run Lion from TypeScript, Check the shape of data, or Enforce rules on your data.
- Need an exact answer? The reference describes every special form, logic form, standard library function, and command.
- Wondering why Lion works the way it does? Start with Why programs are JSON or How Lion's proof kernel and solvers fit together.
Every example is live
A program with a result under it is a live example. Edit the program and it runs again; press ⌘/Ctrl + Enter to run it at once, or Reset to bring back the original.
["number/multiply", ["number/add", 1, 2], 4]
12
Examples run in your browser on the same evaluator as @lionlang/core. Each one starts from the standard library, a fresh environment, and an empty logic database, so examples never affect each other. The results printed on this page were computed by that evaluator when the docs were built.
Press / anywhere to search. Search finds documents, sections, and every form and function by name.