jank
БесплатноЗапускает вложенные скриптыНе проверенjank-lang: native Clojure on LLVM with seamless C++ interop. Use when writing native Clojure, bridging C/C++ libraries, or applying SICP Ch4-5 metalinguistic…
от plurigrid★ 73 звезды на GitHubОб этом скилле
jank
Write Clojure for humans, compile to LLVM IR for machines.
Native Clojure on LLVM. Seamless C++ interop. 3,117 stars. Alpha January 2026. Jeaye Wilkerson.
Use: native perf, C/C++ libs, AOT binaries, SICP Ch4-5 concretely.
Don't use: pure JVM (clojure), scripting (babashka), browser (shadow-cljs).
Theoretical Foundations
| Source | Concept | jank |
|---|---|---|
| SICP 1 | λ, higher-order fns | fns → LLVM IR; closures = GC'd C++ objects |
| SICP 2 | Abstraction barriers | Persistent data in C++; convert<T> = barriers |
| SICP 3 | State, concurrency | future (#674); atom/ref/agent; thread-safe |
| SICP 4 | Metacircular eval | jank IS it — Clojure evaluating Clojure → native |
| SICP 5 | Register machines, GC | LLVM IR = registers; Boehm GC = 5.3; AOT = 5.5 |
| SDF 1-2 | Combinators, DSLs | cpp/raw,cpp/cast,cpp/box compose; cpp/ = sub-DSL |
| SDF 3-4 | Generic ops, matching | convert<T> traits + Clang overload resolution |
| SDF 7 | Propagators | Bidirectional: jank string ↔ std::string |
| SDF 8 | Degeneracy | REPL → JIT → AOT = multiple paths, same result |
Compile AND interpret simultaneously. C++ interop = escape hatch into the machine.
Pipeline
Statically typed. Zero overhead. No reflection. Four stages per interop call:
- Wrapper — C++ helper (unpack args, box return)
convert<T>— trait-resolved type conversion at compile time- Pointer adj —
this, const/ref for members - IR — CppInterOp → LLVM IR → linked
Bootstrap: Phase 1 builds compiler (C++/LLVM), Phase 2 compiles jank's stdlib with itself.
Interop
:: → . (std::string → std.string). Clojure resolves first; cpp/ disambiguates.
;;; HEADERS — cpp/raw: global scope, returns nil, workaround escape hatch
(cpp/raw "#include <cstdlib>")
(cpp/raw "struct vec2 { float x{}, y{}; };
vec2 operator+(vec2 const &l, vec2 const &r)
{ return { l.x + r.x, l.y + r.y }; }")
;; -I <path> -D FOO -L <path> -l <lib>
;; :jank {:include-dirs [...] :library-dirs [...] :linked-libraries [...]}
;;; FUNCTIONS — overloads, implicit conv, void→nil, variadics, templates
(printf "result: %d\n" (rand))
(let [u (getenv #cpp "USER")] (println u)) ; #cpp = unboxed C++ value
;;; MEMBERS — .foo call, .-foo field (public, const/ref-qual aware)
(let [s (cpp/cast std.string "meow")] (.size s) (.substr s 1 3))
(.-npos std.string)
;;; OPERATORS — 45: + - * / % == != < > <= >= && || ! & | ^ ~ << >> = += [] * -> ++ --
(let [ab (cpp/+ (vec2. #cpp 1.0 #cpp 2.0) (vec2. #cpp 4.0 #cpp 3.0))]
(println (.-x ab) (.-y ab)))
;;; TYPES
#cpp 42 #cpp 3.14 #cpp "hello" ; unboxed int, double, char[]
cpp/true cpp/false cpp/nullptr ; native C++ bool/null
(cpp/value "std::numeric_limits<int>::max()") ; complex exprs
(cpp/type "std::map<std::string, int (*)(int)>"); templates
cpp/int** ; pointer types
;; enums (scoped+unscoped), function ptrs, functors/lambdas all work
;;; CAST
(cpp/cast cpp/int (rand)) ; static_cast + convert<T>
(cpp/unsafe-cast (cpp/type "unsigned char*") s) ; reinterpret_cast
;;; MEMORY — bdwgc GC; cpp/delete eager for RAII
(let [p (cpp/new cpp/int (cpp/int. 500))] (assert (= 500 (cpp/* p))) (cpp/delete p))
;;; ARRAY + BOX
(cpp/aget arr idx)
(let [b (cpp/box (cpp/new my_db.conn #cpp "localhost:5758"))]
(.query (cpp/unbox my_db.conn* b) "SELECT 1")) ; compile-time type check
;;; CONVERT TRAIT — custom: specialize jank::runtime::convert<T>
;; template <> struct jank::runtime::convert<MyType> {
;; static MyType from(object_ptr o) { ... }
;; static object_ptr to(MyType const &v) { ... } };
Examples
;; JSON pretty-printer (header-only nlohmann/json)
(cpp/raw "#include <fstream>") (cpp/raw "#include \"json.hpp\"")
(defn -main [& args]
(let [f (std.ifstream. (cpp/cast std.string (first args)))]
(println (.dump (nlohmann.json.parse f) 2))))
;; zlib compression (-l z)
(cpp/raw "#include <zlib.h>")
(defn compress-str [input]
(let [src (cpp/cast (cpp/type "const Bytef*") input)
n (cpp/cast cpp/uLong (count input))
dn (compressBound n)
dst (cpp/new (cpp/type "Bytef") dn)]
(compress dst (cpp/& dn) src n) (cpp/box dst)))
;; FTXUI hiccup → C++ flexbox
(render-hiccup [:vbox
[:hbox [:text "NW"] [:filler] [:text "NE"]] [:filler]
[:hbox [:filler] [:text "center"] [:filler]] [:filler]
[:hbox [:text "SW"] [:filler] [:text "SE"]]])
Usage
jank repl # eval/apply
jank run app.jank # JIT
jank -I vendor -l z run app.jank -- args # + native libs
jank compile app.jank -o app # AOT binary
lein new org.jank-lang/jank proj && lein run # Leiningen
lein compile # AOT → ./a.out
zerobrew install jank-lang/ja
Установить jank в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл jank?
jank-lang: native Clojure on LLVM with seamless C++ interop. Use when writing native Clojure, bridging C/C++ libraries, or applying SICP Ch4-5 metalinguistic abstraction concretely.
Как установить скилл jank?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл jank запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic