23252826a0f26a82378e17cf8c46486847a2af81
- New chapter 05-clojure-nim.md (EN + BG) covering: - Native compilation pipeline (Clojure → Nim → C → binary) - AI-powered development (error explanation, code generation) - JSON REPL for AI agents - loop/recur with real TCO - Cross-compilation: JS, shared libs, WASM - Persistent data structures (HAMT) - Concurrency: atoms, agents, channels - Updated book README.md with Clojure/Nim focus - Added Clojure/Nim terms to subject indices (EN + BG) - Removed books/ from .gitignore so it can be pushed to GitLab
Clojure/Nim
A Clojure dialect that compiles to Nim → C → native binaries.
Quick Start
git clone https://gitlab.com/balvatar/lisp-nim.git
cd lisp-nim
make build
make check
./cljnim run examples/hello.clj
Documentation
- English — Getting started, architecture, AI integration, API reference
- Български — Първи стъпки, архитектура, AI интеграция, API справочник
What is this?
Clojure/Nim is an AI-first Clojure implementation targeting the Nim ecosystem. It compiles Clojure source directly to Nim, then to C, and finally to a native binary.
Why?
- Native Performance — No JVM warmup, no GC pauses
- Tiny Binaries — Single-file executables, often under 1MB
- Nim Ecosystem — Direct access to Nim and C libraries via FFI
- AI-Native — JSON REPL, batch evaluation, AI-assisted error messages and code generation
Key Features
| Feature | Status |
|---|---|
| Compiler (Clojure → Nim → C → native) | ✅ |
| REPL with JSON protocol | ✅ |
Macro system (defmacro, syntax-quote, ->, ->>) |
✅ |
| Persistent data structures (HAMT vector/map) | ✅ |
| Atoms, Agents, Channels | ✅ |
loop/recur |
✅ |
try/catch/finally |
✅ |
| AI integration (DeepSeek, OpenAI, MiMo) | ✅ |
| Cross-compilation targets (JS, WASM, shared libs) | ✅ |
| 276+ tests | ✅ |
Example
;; examples/math.clj
(defn factorial [n]
(if (= n 0)
1
(* n (factorial (- n 1)))))
(println (factorial 5)) ;; => 120
$ ./cljnim run examples/math.clj
120
AI-Powered Development
export DEEPSEEK_API_KEY="sk-..."
./cljnim ai "function that sums a list using loop/recur"
See docs/en/03-ai-integration.md for details.
License
MIT — see LICENSE
Languages
Nim
88.4%
JavaScript
8.1%
Shell
1.5%
Python
0.8%
HTML
0.6%
Other
0.6%