Introduction

Use Lispex to calculate a decision from input data. Read two examples, then run your first program.

Use Lispex to write the decisions an app makes, such as a publisher's house style, and return the answer as data. Start with two examples, then run your first program.

You can try both examples in the Playground with no installation. You only need to recognize a function call and a true-or-false question.

Add two numbers

LISPEX
(+ 2 3)

Result

OUTPUT
5

The parentheses group an expression. + names the operation, and 2 and 3 are its inputs. Lispex calls operations like this procedures.

Decide where a chapter starts

This publisher starts every chapter on an odd page.

LISPEX
(define last-page 37)

(if (odd? last-page)
    '(decision insert-blank-page)
    '(decision start-now))

Result

OUTPUT
(decision insert-blank-page)

define gives 37, the last page of the previous chapter, the name last-page. The test (odd? last-page) is true, so if chooses the first answer. The next page would be 38, so a blank page comes first. If the previous chapter ended on an even page, it would choose (decision start-now).

The leading quote keeps (decision insert-blank-page) as a list of data. Without the quote, Lispex would try to call a procedure named decision. Your application can read the list and add the blank page.

Run your own program

The First Program walks through running code, changing a number, and fixing a missing parenthesis. The Learning Path continues through six lessons to a house style rule with tests for 2 lines left, 1 line left, and a chapter heading.

Your next taskPage
Run code in the browser or save a local fileFirst Program
Look up common syntaxSyntax at a Glance
Look up a form or procedureSyntax Reference or Procedure Index
Read SICP and edit and run its examplesLispex · SICP course

How a rule gets its input

Your application supplies the input and decides what to do with the answer. Lispex rules have no hidden network calls, clocks, random values, or package imports. The reference implementation uses exact arithmetic where possible and defined evaluation and diagnostic rules.

To compare runs, keep the source bytes, input bytes, executor, and resource profile the same. A resource profile specifies the work and memory available to a run. Compare the same result, output, and diagnostic channels, as described in Repeatable Results and Execution Limits.

Ordinary execution runs trusted source directly in the calling process. Tools that compare execution methods and the authoring evaluator in lispex mcp serve use this model too. To set work and memory limits for a decision rule, use Native lispex embed. It runs inside the calling process and produces a record linking the rule, input, limits, and outcome when execution completes. Follow the resource profile guide for the required files and commands.

When you need to save or share a rule

TaskFeature and guide
Store exact source bytes in pixels and recover themLispex Images
Prepare instructions for a virtual machine, a program that runs those instructions locallyRun Verified Bytecode
Check a signed decision against your source, input, and required local resultLispex Vouch
Write a rule and connect it to an applicationWrite and Use Rules
Save bytecodeBytecode and Deployment
Investigate differences between implementationsCompare Implementations

The runtime reference covers the reference implementation and the interpreters used to compare results. For the next lesson, open First Program.