meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
markaddleman 2020-08-27T15:24:43.198300Z

I have a value in the surrounding Clojure context in some local variable x that I want to use inside the meander program. I think the idiom is to pass in x using something like (m/rewrite {:x x, :rewrite-data ...} . Sometimes, it's inconvenient to use this idiom because it gets reflected in most / all of the rewrite rules. Is there another way to pull x from the Clojure context into meander? There may be a way to abuse m/app but is there a nicer way?

jimmy 2020-08-27T16:13:39.198400Z

You can use unquote.

(let [x 2]
  (m/rewrite {:x 2 :y 3}
    {:x ~x :y ?y}
    {:y ?y}))
;; =>
 {:y 3}

markaddleman 2020-08-27T16:41:41.198600Z

great. thanks!

jimmy 2020-08-27T18:08:44.199100Z

Haha, yeah there is a lot going on it is easy to miss.