首页 > AI前沿 > Jolt – Clojure that speaks C

Jolt – Clojure that speaks C

Hacker News 2026-11-17 00:23 15 阅读 查看原文
Usage Evaluate an expression $ jolt -e '(->> (range 10) (filter even?) (map (fn [x] (* x x))) (reduce +))' # 120 $ jolt -e '(/ 1 2)' # 1/2 Run a project jolt run -m myapp.core # resolve deps.edn, then run -main jolt -M:test [args] # run an alias's :main-opts jolt path # print the resolved source roots Compile a standalone binary jolt build -m myapp.core -o myapp # single self-contained executable ./myapp arg1 arg2 # runs anywhere; args reach -main # --opt for the optimized build, --dev for an unoptimized one Bind a C library (require '[jolt.ffi :as ffi]) (ffi/load-library "libsqlite3.dylib") ; or declare :jolt/native in deps.edn (ffi/defcfn sqlite3-libversion "sqlite3_libversion" [] :string) (sqlite3-libversion) ; => "3.51.0" Any C library binds the same way: the native interop guide covers types, memory, structs, and static linking. nREPL jolt --nrepl-server # auto-resolves deps.edn, writes .nrepl-port # connect CIDER / Calva / Cursive via the .nrepl-port file, then # redefine a var and the next call sees it; no restart Develop against a live process: see REPL-Driven Development. Read the documentation for installation, writing libraries, and C interop.