First Program

Run a Lispex program in the Playground or from a `.lspx` file, understand its output, fix one reader error, and add the official editor extension.

The fastest way to understand Lispex is to change a program and see the value change. Start in the browser. Install a local runtime only when you want to keep a file.

Run it in the Playground

Open the Playground, replace the editor contents with this program, and choose Run:

LISPEX
(define language "Lispex")

(list 'hello language (+ 2 3))

Result

OUTPUT
(hello "Lispex" 5)

The first form gives the string "Lispex" the name language. The final form builds a list from a quoted symbol, that string, and the result of (+ 2 3). The Playground prints the value of each top-level expression that produces one or more values; define itself produces no printed value.

Change 3 to 8 and run again. If the final element becomes 10, you have completed the browser part of the lesson.

Keep it as a local file

Save the same source as hello.lspx. Choose either local product:

SHELL
npx lispex hello.lspx

or download the Native binary for your platform and run:

SHELL
lispex hello.lspx

Both commands use the Rust reference evaluator. The npm package carries that core through WebAssembly; the Native binary runs it directly. See Downloads for platform-specific installation and checksum steps.

That is all a first program needs. Native users who later want a canonical compiled artifact can continue to Run Verified Bytecode; the beginner course remains source-first.

Add editor color, the file icon, and formatting

The official extension recognizes .lspx files, highlights Lispex syntax, supplies the Lispex file icon for light and dark themes, and formats a document through the installed Native CLI:

Its exact identifier is studiohaze.lispex. After installing the Native binary, use Format Document or format-on-save. The extension runs lispex fmt -; set lispex.format.executable if the binary is not on PATH. It does not bundle a runtime, language server, autocomplete, hover types, or editor diagnostics. Formatting is not available through npm, public WASM, or the Playground.

Read one diagnostic

Now remove the closing parenthesis from the first define:

LISPEX
(define total 10

(+ total 5)

The command exits unsuccessfully and reports an E100 reader diagnostic. The important part is the stage: Lispex could not finish reading one source form, so no expression ran. Restore the ) after 10 before looking for a runtime problem.

Diagnostics are written to standard error and a failed run returns a non-zero exit status. Later, Diagnostics separates reader, normalization, runtime, and resource failures.

Exercise

Change the successful program so it prints:

(hello "Lispex" 12)
Show one answer

Change the final expression to (list 'hello language (* 3 4)). The nested call (* 3 4) is evaluated before list receives its three values.

Ready for Step 2?

Continue when you can point to the name, the string, the nested call, and the final list in the first program. Next: Values, Names, and Procedures.