10e4ec07d6
- New docs/index.md with language selector - docs/en/ — 01-getting-started, 02-architecture, 03-ai-integration, 04-api-reference, 05-user-guide, 06-roadmap - docs/bg/ — same structure in Bulgarian - Root README.md trimmed to quick-start + links to docs/ - Removed old flat docs/ files (ARCHITECTURE.md, AI_FIRST.md, etc.) - Added swap!/reset! examples to getting-started guides
77 lines
2.1 KiB
Markdown
77 lines
2.1 KiB
Markdown
# Clojure/Nim
|
|
|
|
> A Clojure dialect that compiles to Nim → C → native binaries.
|
|
|
|
[]() []() []()
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
git clone https://gitlab.com/balvatar/lisp-nim.git
|
|
cd lisp-nim
|
|
make build
|
|
make check
|
|
./cljnim run examples/hello.clj
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- **[English](docs/en/index.md)** — Getting started, architecture, AI integration, API reference
|
|
- **[Български](docs/bg/index.md)** — Първи стъпки, архитектура, 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
|
|
|
|
```clojure
|
|
;; examples/math.clj
|
|
(defn factorial [n]
|
|
(if (= n 0)
|
|
1
|
|
(* n (factorial (- n 1)))))
|
|
|
|
(println (factorial 5)) ;; => 120
|
|
```
|
|
|
|
```bash
|
|
$ ./cljnim run examples/math.clj
|
|
120
|
|
```
|
|
|
|
## AI-Powered Development
|
|
|
|
```bash
|
|
export DEEPSEEK_API_KEY="sk-..."
|
|
./cljnim ai "function that sums a list using loop/recur"
|
|
```
|
|
|
|
See [docs/en/03-ai-integration.md](docs/en/03-ai-integration.md) for details.
|
|
|
|
## License
|
|
|
|
MIT — see [LICENSE](LICENSE)
|