Fork me on GitHub
Jimmy Miller00:05:00

With match you can just use assoc or update.

(m/match {:name "jimmy"
            :stuff 1}
  {:name ?name
   :as ?my-map}

  (assoc ?my-map :extra-name ?name))
But if you want to do something a little more meandery, you could use rewrite.
(m/rewrite {:name "jimmy"
            :other-name "Stuff"
            :stuff 1}
  {:name ?name
   :other-name _
   & ?rest}

  {:name (m/app str "hello " ?name)
   :other-name "thing"
   & ?rest})


Thanks! I'll try those out


It seems like meander is great for querying a data structure or re-writing it in a different shape, but that if I want a straightforward assoc-in or update-in then it's just as clear and concise to use assoc-in and upate-in directly. Is that fair? I'm still getting the hang of where it makes sense to use meander.


It all depends on the context and what you like. 🙂


assoc-in and update-in are nice when their mix of semantics, convenience, etc. are more practical. rewrite is specifically designed for shape to shape transformation, not “in-place” transformation. That being said, you can still do nested transformations with rewrite by using the cata operator, this is my personal tendency.


I’d love to hear your thoughts, good and bad, on how it works with your re-frame app.


I’ve wanted to mess around with something like that. 👍


[meander/epsilon "0.0.421"] is out which addresses the cases where bad Clojure code being generated would trigger a clojure.lang.Compiler$CompilerException due to symbols being unresolveable.


I’m sorry it took me so long to patch it. I was on vacation last week, busy before that, and couldn’t take a serious look until today.


Thank you, Joel! No problem at all. And thanks a lot for your time and effort to create meander. It really opened new paths to develop some stuff I have been working with.


@noprompt I'll let you know how it goes with re-frame. I thought meander match might offer a clear way to write queries that involve joins, which seem to often come up when using the "" for db structure described by Eric Normand. So far so good :-)