Clojure, core.logic, mini-kanren, Reasoned Schemer
-
12-06-2021 - |
Question
Code
(defn ex20 []
(run*
[x]
(resto '(c o r n) (list x 'r 'n))))
(defn ex20a []
(run*
[x]
(resto '(c o r n) `(~x r n))))
Results
(ex20) -> (o)
(ex20a) -> ()
Question:
Why? What's going on? Is there some weird interaction between run* and macros?
Thanks!
Solution
syntax-quote namespaces symbols:
(defn ex20a []
(run* [x]
(resto `(c o r n) `(~x r n))))
or
(defn ex20a []
(run* [x]
(resto '(c o r n) (list x 'r 'n))))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow