macro works
This commit is contained in:
parent
11dd0a1d15
commit
2f5d2320bd
2 changed files with 4 additions and 7 deletions
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue