Files
bara-lang/books/clojure-book/README.md
T
dimgigov 23252826a0 feat: add Clojure/Nim chapter to the book + restructure for GitLab
- 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
2026-05-08 23:32:11 +03:00

1.9 KiB

Clojure/Nim — The Native Clojure Book

A practical guide to Clojure that compiles to native binaries. No JVM required.

What You Will Learn

This book teaches Clojure through the lens of Clojure/Nim — a real compiler that turns your Clojure code into native machine code via Nim and C.

You do not need Java. You do not need Leiningen. You need Nim, a C compiler, and curiosity.

Book Structure

Chapter Topic Why It Matters
01 — Fundamentals Syntax, data structures, functions, control flow The foundation. Applies to all Clojure dialects.
02 — Advanced Transducers, specs, parallelism, performance Write code that scales.
03 — Tooling Project structure, deps, testing, debugging Ship reliable software.
04 — Recipes Common patterns, state management, APIs Copy-paste solutions that work.
05 — Clojure/Nim Native compilation, AI integration, JSON REPL, WASM What makes this dialect unique.

Quick Start

git clone https://gitlab.com/balvatar/lisp-nim.git
cd lisp-nim
make build && make check
./cljnim run examples/hello.clj

Running the Examples

Most examples work in any Clojure REPL. Chapter 5 examples are specific to Clojure/Nim:

# Human REPL
./cljnim repl

# JSON REPL (for AI agents)
./cljnim repl --json

# Compile to native binary
./cljnim run myprogram.clj

# Generate code with AI
./cljnim ai "function that reverses a list"

Language Versions

Stats

  • 8 chapters (4 core + 4 translated)
  • 1 new chapter on Clojure/Nim (native compilation, AI, cross-targets)
  • All code tested against Clojure/Nim v0.1.0

This book is maintained as part of the Clojure/Nim project.