Skip to content

Forms

The complete list of special forms — those whose evaluation rules are NOT ordinary function-call semantics. Anything not here is either a primitive (see Built-ins) or a user-defined function.

Definition

FormMeaning
(define name expr)bind name in the current scope
(define (name params...) body...)sugar for (define name (lambda (params...) body...))
(set! name expr)mutate an existing binding
(define-package "name" :description … :exports … :effects … :requires … :version …)package manifest at top of a .lisp file
(provide 'name)finalize current package's exports

Functions and binding

FormMeaning
(lambda (params...) body...)create a closure
(lambda (params... . rest) body...)closure with rest parameter
(let ((name expr) ...) body...)parallel local bindings
(let* ((name expr) ...) body...)sequential local bindings (each can see the previous)
(letrec ((name expr) ...) body...)mutually-recursive local bindings
(let-values ((names expr) ...) body...)bind multiple values
(begin body...)sequence

Control flow

FormMeaning
(if cond then else) / (if cond then)branch
(cond (test body) ... (else body))multi-arm
(when cond body...)sugar — (if cond (begin body...) nil)
(unless cond body...)sugar — (if cond nil (begin body...))
(and ...) / (or ...)short-circuit
(case expr ((vals...) body) ...)dispatch on equality

Quoting

FormMeaning
(quote x) / 'xliteral datum
(quasiquote x) / `xquasi-quote with escapes
(unquote x) / ,xescape inside quasi-quote
(unquote-splicing x) / ,@xsplice inside quasi-quote

Effects and conditions

FormMeaning
(effect op args...)dispatch effect to backend
(handle ((op handler) ...) body)install effect handlers for dynamic extent
(condition kind message data...)construct a condition
(signal cond) / (raise cond)raise it
(handler-case body (kind handler-body) ...)catch by kind

Continuations

FormMeaning
(call/cc fn)call function with current continuation
(call-with-prompt prompt body handler)delimited continuations
(reset body) / (shift k body)shift/reset (where the package provides them)

Nondeterminism

FormMeaning
(amb v1 v2 ...)nondeterministic choice (with backtracking)
(require pred)succeed iff pred; backtrack on false
(amb-fail)force backtrack

Reflection / governance

FormMeaning
(with-profile prof body)install a Profile for the body
(with-budget budget body)install a budget
(with-caps caps body)restrict capabilities
(ctx/snapshot)reify current context
(machine-from-expr expr)construct a MachineVal from an expression
(machine-step m)step a machine one transition
(machine-fork m)clone a machine

Macros

FormMeaning
(register-macro 'name transformer)register a macro
(make-transformer proc :name n)create a MacroTransformerVal
(define-syntax name transformer)scheme-style syntax binding

See also

Source: Form list reconstructed from projects/omega-lisp/src/core/eval/machine.ts (transition cases), core/syntax/ (binding/lexical info), core/expand/ (expander recognition). Use :doc <form> in the REPL for the live signature of any form.