I/O and Application Permissions

Print values from a Lispex program and decide which inputs and external actions the calling application handles.

You can print text and values from a Lispex program. The calling application supplies external data and decides whether to act on a returned decision.

With Native Lispex installed, save this complete source as output.lspx.

LISPEX
(begin (display "answer=") (write 42) (newline) 0)

Run it.

SH
lispex run output.lspx

The command prints the following text and exits with code 0. It creates no files.

answer=42
0

The program explicitly prints answer=42 and a line break. Native then prints the form's returned value, 0, on its own line.

ProcedureWhat it writes
displayText for people to read
writeA value in readable Lispex notation
newlineOne line break
printlnThe same text as display, followed by a line break

All four procedures return zero values. Interactive execution prints each completed top-level form's values after its explicit output. Batch execution records returned values separately and puts only explicit output in stdout.

Read output when execution stops

The resource profile sets the output-byte limit. Native whole-source execution handles ordinary errors and resource stops differently.

OutcomestdoutExit code
Successful executionExplicit output and returned values0
Ordinary runtime errorOutput committed before the error1
Resource limit reachedEmpty2

For example, save this as output-error.lspx.

LISPEX
(display "before\n")
(car 1)
SH
lispex run output-error.lspx

stdout is before followed by a line break. stderr is shown below. The command exits with code 1 and creates no files.

E310 output-error.lspx:2:1 car: expected a pair, got 1

The CLI reads and normalizes the complete source before evaluating it. A source error at that stage leaves stdout empty. See Resources for resource outcomes.

Assign external work to the application

A supported procedure and a host permission answer different questions. The procedure describes what the rule can compute. The permission determines which external action the calling application may perform.

OperationWho handles it
Value and text outputLispex output procedures
Source file and standard-input selectionThe CLI invocation
File and network accessThe calling application's adapter
Time and randomnessThe application supplies them as explicit input
Databases and transactionsThe application manages state and commits
Payments, deployments, and other external actionsThe application applies its policy after checking the decision

Native MCP exchanges source, an optional input value, and results over local standard input and output. It applies its declared byte and time limits. Application adapters pass reviewed data to the rule and use the returned decision.

Run Lispex in Your Application · Decision Rules