meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
2019-12-22T02:31:15.060100Z

Ok, another stumper for me. I have

{:plus 10
 :map  {:a1 {:a12 {:b 1}}
        :a2 {:b 2}}}
I'd like the result to be
{:plus 10
 :map  {:a1 {:a12 {:b 11}}
        :a2 {:b 21}}}
My program is
(m/rewrite {:plus 10
              :map  {:a1 {:a12 {:b 1}}
                     :a2 {:b 2}}}
             (m/and {:plus ?plus}
                    (m/$ ?context {:b (m/some ?b)}))
             (m/app ?context {:b (m/app + ?b ?plus)}))
which, of course, handles the first instance of {:b _} . There's some fundamental piece of gather and rewrite vs rewrites that I'm missing, I think.

jimmy 2019-12-22T03:51:12.067Z

Doing generic, randomly nested, transformations where the structure doesn't change isn't something we've optimized for. You can do some of this more easily with strategies (on my phone so I can't give an example right now). What we focus on is what we see as the more common case changing from one structure to another. Tools like Specter are focused on generic, arbitrarily nested "update-in-place" style transformations. They can be very succinct but often imo not very readable. I've found often when I am doing this style of transformation is because I think it would be easier than doing all the transformations at once. But with meander that is no longer the case.

1👍