Skip to content

The REPL

Shell
ilo repl

You get an interactive prompt where you can define functions and evaluate expressions:

ilo
ilo> dbl x:n>n;*x 2
ilo> dbl 5
10
ilo> inc x:n>n;+x 1
ilo> inc 10
11

Functions, types, and aliases persist across lines. Build up a program incrementally.

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
Terminal window
> 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) -> t

A blank line or balanced braces submit the input.

Chain functions you’ve already defined:

ilo
ilo> dbl x:n>n;*x 2
ilo> inc x:n>n;+x 1
ilo> 5 >> dbl >> inc
11
CommandWhat it does
:defsShow all definitions (functions, types, aliases)
:w file.iloSave definitions to a file
:clearStart fresh
:helpShow help
:qQuit

For agent integration, use -j to get structured JSON output:

Shell
ilo repl -j

Success:

JSON
{"ok": 10}

Error:

JSON
{"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 :defs to remind yourself what’s in scope
  • Use :w to save a working session to a file when you’re happy with it