Curry is an R7RS Scheme implementation with practical R6RS compatibility, a numeric tower extending through the hypercomplex numbers into Clifford algebra, a built-in computer algebra system, quantum superposition values, first-class matrices, tensors, and spinors, a CL-style condition system with restarts, a general C FFI, STM and CSP channels alongside the actor-model concurrency system, a modular C extension interface, and a built-in LLM client that can talk to Claude, GPT-4o, Ollama, or any OpenAI-compatible endpoint — with multi-turn conversation, tool use, and a full agentic loop.
Source is compiled to bytecode and executed on a stack-based VM. When built with LLVM (-DBUILD_LLVM=ON), hot closures are automatically compiled to native machine code after 50 calls via an ORC v2 JIT backend. Compiled chunks are cached in .scc files (source-adjacent, or ~/.cache/curry/ for read-only paths) and reused on subsequent runs, invalidated automatically on source change or version bump. Use -c file.scm to pre-compile without running; .scc files can also be passed directly as the script argument.
Error messages are rendered in Standard Babylonian Akkadian with cuneiform script (𒀭 ḫiṭītu — great fault), as scribal tradition demands.
See docs/PHILOSOPHY.md for why the project is built this way — pluggable logics, an open-ended numeric tower, and no single "correct" answer treated as bedrock.
Documentation is split into two directories:
docs/reference/— language specification, numeric tower, CAS, module APIsdocs/guides/— installation, tutorials, how-tos, worked examples
- Language reference — syntax, types, special forms, numeric tower, symbolic math, quantum values, Akkadian syntax, actors, module system
- Symbolic expressions — CAS reference: variables, differentiation, integration, simplification, substitution, complex operators, Wirtinger calculus, auto-diff
- Quantum superposition — quantum value type: construction, observation, arithmetic
- Surreal numbers — Hahn-series surreals: ω, ε, exact infinitesimals, auto-diff
- Multivectors — Clifford algebra Cl(p,q,r): geometric product, rotors, PGA, CGA
- Akkadian / Cuneiform reference — complete vocabulary of special forms and procedures in all three languages, plus the runtime error-message phrase table
- Error codes — stable machine-legible
error-object-code/condition-coderegistry for tooling - Module index — the full list of
(curry ...)modules, import names, and extra build dependencies - SRFI compatibility — the 25 portable
(srfi sN name)libraries, one page each - Parallel map/reduce — the work-stealing thread pool behind
map/reduce - LLVM JIT backend — auto-JIT, benchmark numbers, build flags
- Garbage collector reference — the two GC backends and
(gc-stats)fields
- Installation — Homebrew (macOS), build from source, Qt6, test suite
- LLM integration — talking to Claude, OpenAI, and Ollama; tool use, agentic loops, structured output, MCP servers, CAS-backed AI
- Raspberry Pi / embedded hardware — setup guide for Pi; GPIO, I2C, SPI, PWM
- MCP server — expose Curry procedures as Model Context Protocol tools callable from Claude Code and other AI clients
- macOS app bundler — bundle any Curry script as a
.appwith Qt frameworks embedded - Monitoring guide — using
(gc-stats), running the Grafana stack (Docker and Apple Containers), customizing dashboards, publishing custom metrics - Benchmarking reference — bench suites, MQTT event schema, all GC stat fields
- Profiling reference —
**eval-profiler**,(curry profiling)API,,profileREPL command, timing workflows
Fixnum → bignum → rational → flonum → complex → quaternion → octonion → multivector → surreal → symbolic. Arithmetic automatically promotes through the tower: (+ 1/3 0.5) → flonum, (∂ (* x x) x) → symbolic (+ x x). See docs/reference/language.md for the full type/predicate/constructor table.
Symbolic differentiation/integration, simplification, Wirtinger calculus, fractional calculus, and infix/LaTeX output — see docs/reference/symbolic.md for the full quick-reference table.
map and reduce automatically parallelise over multiple CPU cores on a persistent work-stealing thread pool; sequential variants are always available. See docs/reference/parallel.md.
The global source is seeded from /dev/urandom on first use (xoshiro256+). See docs/reference/srfi/s27.md.
Curry ships ~35 optional and always-on modules — databases, HTTP/GraphQL/MQTT clients, an LLM client, image/scientific-data I/O, FFI, concurrency primitives, and more. Full list with import names, descriptions, and extra build dependencies: docs/reference/modules.md.
25 portable SRFI libraries under the (srfi sN name) naming convention — compatible with Guile, Chicken, and Chibi-Scheme. Full index: docs/reference/srfi/index.md.
Curry can talk to any LLM out of the box. No API wrappers, no external packages — just import and go.
(import (curry llm))
; One-shot question (Ollama, local, no key needed)
(display (llm-ask (make-llm-client 'ollama "llama3.1") "What is a monad?"))
; Claude or OpenAI (reads key from env)
(display (llm-ask (make-llm-client 'claude) "Explain tail-call optimisation."))Give the model tools it can actually call:
(define conv (make-conversation (make-llm-client 'claude)))
(conv-system! conv "Use tools to answer accurately.")
(conv-tool! conv "sqrt"
"Compute the square root of a number."
'((n "number" "The number"))
(lambda (args) (number->string (sqrt (cdr (assq 'n args))))))
; The model calls sqrt(144), gets "12.0", incorporates it into its reply
(display (conv-send! conv "What is the square root of 144? Use the sqrt tool."))The library runs the full agentic loop automatically — send, detect tool calls, execute lambdas, feed results back, repeat. Supports Anthropic's native tool-use protocol and the OpenAI function-calling protocol; Ollama and any OpenAI-compatible endpoint use the OpenAI path.
See docs/guides/guide-llm.md for ten progressively interesting examples: database queries, parallel actor pipelines, structured output, MCP servers backed by local models, CAS-assisted maths tutors, and more.
When built with -DBUILD_LLVM=ON, Curry adds a tiered native-compilation layer on top of the bytecode VM: any closure called ≥ 50 times is automatically compiled to native ARM64/x86-64 on the next call, transparently — no source changes needed. Typical speedups on recursive/loop-heavy code range 1.1×-14×. See docs/reference/llvm-jit.md for the procedure list, benchmark numbers, and build command.
When built with -DBUILD_FFI=ON, Curry can call any C library directly from Scheme with no glue code.
(import (curry ffi))
(define-foreign-library libm "libm.so") ; Linux
; (define-foreign-library libm "libm.dylib") ; macOS
(define-foreign (c-sin (x double)) → double #:from libm #:c-name "sin")
(define-foreign (c-sqrt (x double)) → double #:from libm #:c-name "sqrt")
(c-sin 1.5707963) ; → 1.0
(c-sqrt 2.0) ; → 1.41421...Zero-copy matrix passthrough — pass a matrix or tensor's raw double* directly to C (e.g. BLAS) with no copying:
(with-pinned-matrix A pa
(with-pinned-matrix B pb
(with-pinned-matrix C pc
(cblas-dgemm CblasRowMajor CblasNoTrans CblasNoTrans
rows cols inner 1.0 pa cols pb cols 0.0 pc cols))))Requires libffi-dev on Linux; found automatically via Homebrew on macOS. See docs/reference/module-ffi.md for the full API and type-mapping table.
Curry ships two GC backends, selectable at runtime with --gc boehm (default, conservative, no configuration) or --gc generational (experimental per-thread nursery, lower pause times for allocation-heavy workloads). (gc-stats)/(gc-stats-reset!) expose live counters and pause times. See docs/reference/gc.md for the full backend/flag/stats-field reference, docs/reference/benchmarking.md for the real-time Grafana monitoring stack, and docs/reference/profiling.md for the runtime profiler.
See docs/guides/INSTALL.md for Homebrew installation (macOS), building from source on Linux and macOS (including Qt6 and .deb/.rpm packaging), and running the test suite.
All runtime errors carry a Standard Babylonian preamble identifying the fault category:
𒀭 ḫiṭītu — lā nikkassum:
+: not a number: "hello"
See docs/reference/akkadian-reference.md for the full phrase table.
See CHANGELOG.md for the full release history.