meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
jimmy 2020-05-21T00:14:00.259600Z

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

tobias 2020-05-21T00:29:37.260300Z

Thanks! I'll try those out

tobias 2020-05-21T00:59:46.262700Z

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.

noprompt 2020-05-21T01:20:53.263300Z

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

noprompt 2020-05-21T01:40:44.264800Z

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.

noprompt 2020-05-21T01:45:55.266700Z

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

noprompt 2020-05-21T01:47:32.267900Z

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

noprompt 2020-05-21T03:40:24.271300Z

[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.

noprompt 2020-05-21T03:44:22.272400Z

@nlessa ☝️ that should patch your problem, I even used it as https://github.com/noprompt/meander/commit/3335fc72eae0e3c6d30c9ac6a265b3ccf790f3ce#diff-e7544f9bb8134fa6cdaaa573a3b2a601R2426.

🎉 1
noprompt 2020-05-21T03:45:53.273700Z

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.

nlessa 2020-05-21T13:49:45.276200Z

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.

tobias 2020-05-21T11:39:25.275900Z

@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 "https://purelyfunctional.tv/guide/database-structure-in-re-frame/#Indexed-Entities-Pattern" for db structure described by Eric Normand. So far so good :-)