Skip to content

Standard library

The Omega standard library ships as 13 named packages. From projects/omega-lisp/CLAUDE.md:

Packages: core (37), strings (21), hof (14), streams (12), lazy (4), distributions (10), data-directed (16), trs (9), meta (26), conditions (7), provenance (5), solver (22), solve (31)

Numbers in parens are primitive counts. Total: 214 primitives (snapshot from CLAUDE.md). The exact set evolves; :primitives in the REPL prints the live list.

The thirteen

PackageSnapshot summary
coreNumeric, list, control-flow, comparison, IO. The unconditional baseline.
stringsString ops: split, join, format, regex, case
hofHigher-order: map, filter, fold, reduce, compose, pipe
streamsLazy infinite sequences (cons-stream, stream-car, stream-cdr)
lazyPromises, force, delay
distributionsdist, sampling, top-k, normalization (over DistVal)
data-directedGeneric dispatch via TaggedVal + GenericRegistryVal
trsTerm-rewriting system primitives (rewrite-fixpoint)
metaReflection: make-evaluator, eval-in, extend-evaluator, machine values
conditionsStructured conditions (raise, signal, handler-case)
provenanceReceipts, evidence, source hashing
solverConstraint propagation networks (net/new, net/run, contradictions)
solveGoal-directed problem decomposition (solve, goal, artifact)

How packages enter the runtime

installPrims(ctx, store, registry) (called by OmegaRuntime constructor; exported from src/index.ts:179) installs all standard primitives into the root context. They become available without any (require ...).

User-level Lisp packages (plm/*, aliases/clojure, workflow/*, agents, etc.) require explicit (require 'pkg). They live under projects/omega-lisp/lib/ and projects/omega-lisp/packages/*/lib/.

Discovery in the REPL

:primitives                ; lists all 13 standard packages
:help <package>            ; full tutorial for a package (e.g. :help streams)
:doc <primitive>           ; quick reference for one function
:apropos <pattern>         ; search by name or description

The help system source is in src/core/help/. The discovery flow is documented in omega-lisp/CLAUDE.md § Primitive Discovery.

A handful of canonical primitives

lisp
;; core
(+ 1 2 3)                          ; → 6
(map (lambda (x) (* x x)) (list 1 2 3))   ; → (1 4 9)
(if (> x 0) 'pos 'nonpos)

;; hof
(fold + 0 (list 1 2 3 4 5))        ; → 15
(filter even? (list 1 2 3 4 5))    ; → (2 4)

;; streams (lazy)
(define ones (cons-stream 1 ones))
(stream-take 5 ones)               ; → (1 1 1 1 1)

;; distributions
(define d (dist (list (cons 'heads 0.5) (cons 'tails 0.5))))
(dist-sample d)                    ; → 'heads or 'tails

;; conditions
(handler-case
  (signal 'overflow "limit exceeded")
  ((overflow c) (list 'caught c)))

;; solver
(define net (net/new))
(net/run net :fuel 100)

;; solve
(solve task :decompose split-into-subtasks :delegate assign-to-agents :combine merge :verify check)

See also

Source: projects/omega-lisp/CLAUDE.md § Primitive Discovery (canonical package list and counts), projects/omega-lisp/src/core/help/ (help system), projects/omega-lisp/src/core/prims.ts (the install hook).