Strange Macro behaviour #607
-
Hey, I've using SCI and it work perfectly for simply evaluating strings in the browser. Thanks for the project! I just need to use this particular macro in the browser. I'm using (def with-context ^:sci/macro
(fn [_&form _&env & forms]
(let [gx (gensym)]
`(let [~gx (get-context)]
~@(map (fn [f]
(if (seq? f)
`(~(first f) ~gx ~@(next f))
`(~f ~gx)))
forms)
~gx)))) I tried the macro in a Clojure REPL and works correctly
while using it in SCI seems to don't pass the value correctly. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@elias94 I think the problem is that you're defining the macro in some CLJS namespace |
Beta Was this translation helpful? Give feedback.
@elias94 I think the problem is that you're defining the macro in some CLJS namespace
your-ns
and(get-context)
gets expanded into(your-ns/get-context)
. Ifyour-ns
doesn't match the namespace you are definingget-context
in in the SCI ctx, then this doesn't match up. Perhaps this is sufficient information. If not, please provide a full repro with a failing example and an expected outcome.