Clojure, core.logic, mini-kanren, Reasoned Schemer

305 views Asked by At

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!

1

There are 1 answers

1
dnolen On BEST ANSWER

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))))