The REPL
Start a session
Section titled “Start a session”ilo replYou get an interactive prompt where you can define functions and evaluate expressions:
ilo> dbl x:n>n;*x 2ilo> dbl 510ilo> inc x:n>n;+x 1ilo> inc 1011Functions, types, and aliases persist across lines. Build up a program incrementally.
Multi-line input
Section titled “Multi-line input”The REPL supports multi-line input for type definitions and functions. Continuation is triggered by:
- Unclosed braces - type definitions spanning multiple lines
- Trailing
;- signals more statements to come
> type point{.. x:n.. y:n.. }defined type: point{x:n;y:n}
> cls sp:n>t;.. >=sp 1000 "gold";.. >=sp 500 "silver";.. "bronze"
defined: cls(sp:n) -> tA blank line or balanced braces submit the input.
Pipes in the REPL
Section titled “Pipes in the REPL”Chain functions you’ve already defined:
ilo> dbl x:n>n;*x 2ilo> inc x:n>n;+x 1ilo> 5 >> dbl >> inc11Commands
Section titled “Commands”| Command | What it does |
|---|---|
:defs | Show all definitions (functions, types, aliases) |
:w file.ilo | Save definitions to a file |
:clear | Start fresh |
:help | Show help |
:q | Quit |
JSON mode
Section titled “JSON mode”For agent integration, use -j to get structured JSON output:
ilo repl -jSuccess:
{"ok": 10}Error:
{"code": "ILO-T004", "message": "undefined variable 'y'", "severity": "error", "suggestion": "did you mean 'x'?"}The -j flag also works outside the REPL: ilo 'dbl x:n>n;*x 2' -j 5
- Define helper functions first, then compose them
- Use
:defsto remind yourself what’s in scope - Use
:wto save a working session to a file when you’re happy with it