Open Manual

REPL

The REPL is an interactive scratchpad: it evaluates source and retains imports and definitions between prompts. Use a source file when you need a reproducible bug report, test, or benchmark.

Prerequisites: a Nytrix compiler on PATH.

> print(1 + 2)
3

Value expressions are displayed using their readable representation. For example, a string result includes quotes:

ny> id = fn(x) x
ny> id("ciao")
"ciao"

Start

ny
ny -i
ny --plain-repl
ny -ic 'value = 1337'
ny --repl < file.ny

--repl reads stdin as source once; it is not an interactive prompt. Run ny --help for the installed options.

Work interactively

Type expressions and declarations at the prompt. Use ny doc search to find a symbol or concept. Session state can make a snippet behave differently from a fresh file, so move surprising cases into a file and run them directly.

TaskCommand or action
Inspect the token under the cursorPress F1 for a keyword, declaration, module member, or documented runtime builtin
Browse language forms:help keywords, then :help for, :help @pure, or :help operators
Browse runtime/compiler internals:help internals, then :help __load_item_fast or press F1 on an internal name
Check exported namesny doc search --symbols name
Find docs for a topicny doc search --docs topic
Reproduce a source failureSave the snippet, then run ny file.ny
Validate formattingny fmt --check file.ny

Interactive prompt commands are not source syntax. See the prompt's :help for supported commands. :help keywords lists language forms and types; F1 and :help <name> use the same indexed documentation for language forms, loaded module symbols, and runtime builtins. :help internals lists internal runtime/compiler entries registered by the runtime. Language topics link to their specifications under etc/docs/spec/.

Snapshots

Use the REPL snapshot command only for saving a session that must be restored later. For application source or a regression, prefer a .ny file and an executable fixture; files keep imports, setup, and assertions visible.

Next: