clj-zig is an experiment/demo/proof-of-concept for a Clojure-first, data-oriented interface to ordinary Clojure functions backed by real Zig implementations.
clj-zig is, for now:
clj-zig is not:
The name is clj-zig.
It is descriptive rather than clever: clj for Clojure, zig for the Zig that backs each function. The library defines ordinary Clojure functions whose bodies are real Zig, so the name says what it does.
Primary users:
Clojure and Zig have complementary strengths:
Clojure: data, macros, homoiconicity, REPL, composition, host orchestration
Zig: explicit types, layout, allocators, comptime, C interop, performance
clj-zig's experimental bet is that the seam between them should be a small, explicit, Clojure-data boundary contract.
The experience should not be:
(compile-zig ...)
(load-shared-library ...)
(lookup-symbol ...)
(invoke-native ...)
The experience should be:
(defnz add
[x :i64
y :i64
:ret :i64]
"return x + y;")
(add 1 2)
The user should think:
I defined a Clojure function whose implementation happens to be Zig.
Not:
I manually compiled and loaded a native library.
clj-zig succeeds if:
defnz feels like a natural relative of defn.Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |