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

CLI and REPL Commands

Invocation

narju                          boot the Purple session (default)
narju --raw                    floor REPL, no Purple boot
narju file.naj [file2.naj …]   load files into the floor, then floor REPL
narju -e '(+ 1 2)'             evaluate an expression, then floor REPL
narju --run file.naj           run a file, print each form's result, exit
narju --script file.naj        run a file silently, exit
narju --purple FILE            boot an alternate session script
                               (default: lib/purple.naj)
narju --quiet / -q             suppress the banner

-e repeats, and combines with positional files (files load first). --run and --script exclude positional files and each other.

Two path facts worth knowing. read-file — and therefore load, (load …) in the session, and the Purple boot itself — resolves paths against the process’s working directory first, and retries relative paths under $NARJU_LIB when that variable is set. A repository checkout needs no variable: run from the root, where lib/pink-forms.naj, lib/tower.naj, and lib/prelude.naj are reachable directly. The nix package bakes NARJU_LIB into the binary, pointing at its own copies, so an installed narju boots from any directory — while a user’s own relative paths keep taking precedence. And --purple names a floor program, not a configuration file: anything --script could run can be a session.

The floor REPL

--raw, positional files, and bare -e all end in the floor REPL: one λ↑↓ form per evaluation, results printed with their kind, line editing with history (~/.narju_lud_history), filename completion, and history search on Alt-p/Alt-n. A line may contain several forms; each is evaluated and printed in order.

Commands start with a colon:

:help          this list
:q, :quit      exit
:env           all bindings, with kinds and values
:env <name>    one binding
:ctx           staging context: fresh-name counter, block depth
:load <file>   load a file into the current environment
:reset         clear the environment and the staging context

:ctx and :reset concern the staging state of Part II: residual code built at the top level draws fresh variable names from a counter that persists across forms, and :reset is the way to zero it without restarting.

The Purple loop

The session prompt is not the Rust REPL — it is the let-bound loop at the end of lib/purple.naj, reading data through the floor’s read. It has no colon commands; load and define are recognized as data (the session chapter covers both), everything else is evaluated and printed. End of input — Ctrl-D at a terminal — ends the loop, and with it the process.