macro works

This commit is contained in:
kloimhardt 2021-06-01 11:43:01 +02:00
parent 11dd0a1d15
commit 2f5d2320bd
2 changed files with 4 additions and 7 deletions

View file

@ -3,8 +3,8 @@
[sci.core :as sci]
[scittle.core :as scittle]))
(defn add-low-fn [_env _form x y & zs] `(str "__" ~x ~y ~zs))
(def add-low-makro (with-meta add-low-fn {:sci/macro true}))
(defn add-low-fn [_env _form x y] `(str "_" ~x ~y))
(defn ^:macro add-low-makro [_env _form x y] (add-low-fn _env _form x y))
(def rns (sci/create-ns 'makro-plugin.core nil))

View file

@ -5,11 +5,8 @@
<script type="application/x-scittle">
(require '[makro-plugin.core :as m])
(defn my-alert []
(.log js/console (m/add-low-fn 1 2 3 4 5 6))
;; shows as expected in console: ["cljs.core/str", "__", 3, 4, [5, 6]]
(.log js/console (m/add-low-makro 1 2 3 4 5 6)))
;; shows unexpectedly the same ["cljs.core/str", "__", 3, 4, [5, 6]]
;; instead of "__34[56]"
(.log js/console (m/add-low-fn 1 2 5 6))
(.log js/console (m/add-low-makro 7 8)))
(set! (.-my_alert js/window) my-alert)
</script>
</head>