Lion language
A homoiconic Lisp whose every program is valid JSON, evaluated on Effect, with a Datalog-style logic database and runtime schemas in the same syntax.
Overview
Lion is a homoiconic Lisp whose programs are plain JSON: an array is an expression, an object a record, and a string a name, so one format serves code and data. It evaluates on Effect, and a Datalog-style logic layer, runtime schemas, and a graph editor share that same syntax.
Code
42
true
["number/add", 1, 2]
["number/multiply", ["number/add", 1, 2], 4]
"lion"
["quote", "lion"]
["array/make", 1, 2, 3]
["array/head", ["array/make", 1, 2, 3]]
["array/map", ["array/make", 1, 2, 3],
["lambda", ["x"], ["number/multiply", "x", 2]]]
{"sum": ["number/add", 1, 2], "ok": true}
["object/get-path", {"a": {"b": 42}}, "a.b"]
["begin",
["define", "adder",
["lambda", ["n"],
["lambda", ["x"], ["number/add", "x", "n"]]]],
["define", "add10", ["adder", 10]],
["add10", 32]]
["begin",
["relation", "edge", ["from", "to"]],
["relation", "path", ["from", "to"]],
["fact", ["edge", "a", "b"], ["edge", "b", "c"]],
["rule", ["path", "?x", "?y"], ["edge", "?x", "?y"]],
["rule", ["path", "?x", "?z"], ["path", "?x", "?y"], ["edge", "?y", "?z"]],
["query", ["path", "a", "?to"]]]
The literals evaluate in place and
number/add returns 3, while a name like
"lion" is a lookup first and text only when nothing is bound; array/map
returns [2, 4, 6]; add10 returns 42 because the inner lambda is a closure
that kept n; and the logic layer is not a separate file format — query
derives paths from two rules over the same JSON a value would be written in.Distinctive traits
- Code is data: an array is a special form or a call, so
quotestores a program andevalruns it later. definebinds a lambda like any value, andarray/maptakes a function as an ordinary argument.- Tail-position calls keep nothing of their caller, so a self-recursive lambda loops in constant memory.
- A Datalog-style layer — relations, recursive rules, aggregates,
whyexplanations — reuses the JSON syntax. matchdispatches on a value's shape — predicate, record, or literal — so branching needs no type tag.- Schemas are runtime values, and a relation can declare
{"schema": …}to reject rows that do not fit.
Status
MIT-licensed and pre-1.0: @lionlang/core 0.14.1 shipped in November 2026,
seven months after 0.1.0, and recent releases still record breaking changes.
The repository also ships the CLI, a graph editor, and the docs' browser
evaluator.
Sources & references
- Official sitelionlang.dev
- Lion documentation — evaluation rules, special forms, logic, schemas, standard librarylionlang.dev
- How Lion got here — releases and decisions, generated from the project's own recordlionlang.dev
- andrueandersoncs/lion — source repository, README, and packagesgithub.com
- @lionlang/core — package README published to npmgithub.com
- Effect — the TypeScript effect system Lion's evaluator runs oneffect.website