Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Mar 4, 2025
1 parent b1513af commit 5fbe78a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions notebooks/macro_auto_gensym.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(ns macro-auto-gensym
(:require [macro-with-auto-gensym :as m]))

;; Q: when I change my/macro and re-eval the notebook, should it render the change?

(inc (m/my-macro 1))
5 changes: 5 additions & 0 deletions notebooks/macro_with_auto_gensym.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ns macro-with-auto-gensym)

(defmacro my-macro [x]
`(let [x# ~x]
(inc x#)))
4 changes: 4 additions & 0 deletions src/nextjournal/clerk/analyzer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@
([state file]
(analyze-doc state (parser/parse-file {} file))))

(comment
(analyze-file *file*)
)

(defn unhashed-deps [->analysis-info]
(remove deref? (set/difference (into #{}
(mapcat :deps)
Expand Down
1 change: 1 addition & 0 deletions src/nextjournal/clerk/eval.clj
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
([store ns name val] (record-interned-symbol store ns name) (core-intern ns name val)))

(defn ^:private eval+cache! [{:keys [form var ns-effect? no-cache? freezable?] :as form-info} hash digest-file]
(prn :form form)
(try
(let [!interned-vars (atom #{})
{:keys [result]} (time-ms (binding [config/*in-clerk* true]
Expand Down
2 changes: 2 additions & 0 deletions test/nextjournal/clerk/analyzer_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
(ana/analyze '(do inc))))
(is (empty? (:deps (ana/analyze '(do 'inc))))))

(ana/analyze `(let [a# 1]))

(testing "locals that shadow existing vars shouldn't show up in the deps"
(is (= #{'clojure.core/let} (:deps (ana/analyze '(let [+ 2] +))))))

Expand Down

0 comments on commit 5fbe78a

Please sign in to comment.