#causes the reader macro and reader macros to expand before the regular macro expands. To do what you mentioned, you need to go through the reader in your macro using read-string, as shown below.
(defmacro pred [p v]
(let [s
`(apply ~(read-string s
user=> (pred '(map? %) [{}])
true
user=> (pred '(map? %) [[]])
false
If the data, that is, the predicate expression is available at run time, you need to use a function (which is more flexible than a macro).
(defn pred [p v]
(let [s (read-string (str \
(eval `(apply ~s ~v))))
user=> (map
(false true)
source
share