Sorry for taking so long to reply. I definitely don’t recommend doing this. But just wanted to reply with the eval version.
(def global-counter (java.util.concurrent.atomic.AtomicInteger. 0))
(defn next-id [] (.getAndIncrement global-counter))
(defn apply-rule [graph rule]
(let [[pattern out] rule]
(map vec
(partition
2
(flatten
(eval
`(m/search
~graph
(m/scan ~pattern)
~out)))))))
This will be rather slow as you would be compiling the expression every single time.