diff --git a/.claude/settings.json b/.claude/settings.json deleted file mode 100644 index 963a538..0000000 --- a/.claude/settings.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "hooks": { - "PreCompact": [ - { - "hooks": [ - { - "command": "bd prime", - "type": "command" - } - ], - "matcher": "" - } - ], - "SessionStart": [ - { - "hooks": [ - { - "command": "bd prime", - "type": "command" - } - ], - "matcher": "" - } - ] - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 65e4f7b..178757f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ build/ .clj-kondo/ .dirge/ +.claude/ .lsp/ test/_*.janet diff --git a/.lsp/.cache/db.transit.json b/.lsp/.cache/db.transit.json deleted file mode 100644 index 48e5620..0000000 --- a/.lsp/.cache/db.transit.json +++ /dev/null @@ -1 +0,0 @@ -["^ ","~:classpath",["~#set",[]],"~:project-hash","","~:project-root","/Users/yogthos/src/jolt","~:settings-hash","99914b932bd37a50b983c5e7c90ae93b","~:kondo-config-hash","a5ffe1b0410baf2fa8f60d5a7fcf416d8516c8422ab9d3ed5b4f53e9bb3ddf3f","~:dependency-scheme","zipfile","~:analysis",null,"~:analysis-checksums",["^ "],"~:project-analysis-type","~:project-and-full-dependencies","~:version",13,"~:stubs-generation-namespaces",["^1",[]]] \ No newline at end of file diff --git a/src/jolt/evaluator.janet b/src/jolt/evaluator.janet index 3588e80..058c1dd 100644 --- a/src/jolt/evaluator.janet +++ b/src/jolt/evaluator.janet @@ -683,7 +683,11 @@ (ctx-set-current-ns ctx ns-name) (ctx-find-ns ctx ns-name) nil) - "fn*" (if (array? (in form 1)) + "fn*" (let [# optional name: (fn* name [args] ...) / (fn* name ([args] ...)...) + named? (and (struct? (in form 1)) (= :symbol ((in form 1) :jolt/type))) + fn-name (if named? ((in form 1) :name) nil) + form (if named? (array/concat @[(in form 0)] (tuple/slice form 2)) form)] + (if (array? (in form 1)) # Multi-arity: (fn* ([args] body...) ([args] body...)...) (let [pairs (tuple/slice form 1) arities @{} @@ -707,6 +711,7 @@ (when rest-pat (destructure-bind ctx fn-bindings rest-pat (tuple/slice fn-args i))) (put fn-bindings :jolt/loop-fn self) + (when fn-name (bind-put fn-bindings fn-name self)) # Use defining namespace for symbol resolution (def saved-ns (ctx-current-ns ctx)) (ctx-set-current-ns ctx defining-ns)