Implementation of Nada Amin's Purple
  • Rust 97.9%
  • Nix 2.1%
Find a file
2026-08-21 14:23:54 +10:00
book Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
naj Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
src Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
.envrc Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
.gitignore Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
book.toml Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
Cargo.lock Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
Cargo.toml Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
flake.lock Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
flake.nix Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
LICENSE Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00
README.md Fri 21 Aug 2026 14:23:54 AEST 2026-08-21 14:23:54 +10:00

narju 🐱

narju gismu - x₁ is orange [color] in shade x₂ [medium red-yellow].

this type of lisp is historically named after colours, so narju takes its name from the lojban word for orange - after a handsome orange cat. 🐱

narju is a self-reflective, meta-circular lisp, based on Nada Amin's Collapsing Towers of Interpreters

Running

$ nix run git+https://git.avery.garden/thorn/narju

naj with no argument is the prompt; naj FILE runs a file.

An interpreter is an ordinary value, and which one a procedure runs under is a field of it. So altering the semantics is rebuilding a closure under a different interpreter — no global mutation, and nothing else in scope moves:

> (define (inc n) (+ n 1))
'inc

> (inc 0)
1

> (define (shifted i)
    (with-handler i 'eval-lit
      (lambda h (m l e r k) (apply-cont k ((l 'lift) (+ e 10))))))
'shifted

> ((with-interp inc (shifted (interp-of inc))) 0)
11

> (inc 0)
1

The prompt itself is an object program (naj/repl.naj), as is the library it runs on (naj/prelude.naj) and the evaluator underneath both (naj/tower.naj). The Rust in this repository is λ↑↓ — the stage-polymorphic floor the tower compiles down to — plus a scheduler and the host adapters a task sends messages to.

Documentation for the floor is at narju-docs:

$ nix build .#docs   # rustdoc

Development

a nix development shell is exposed with the rust toolchain, compatible language servers etc

nix develop

License

MIT.