meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
markaddleman 2020-04-04T02:11:55.109800Z

Trying to up my meander game.:

(m/rewrite {:g1 [{:k :a :v 1} {:k :b :v 2}]
              :g2 [{:k :b :v 2} {:k :a :v 1}]}

             (m/and
               {:g1 (m/seqable {:k !k :v !v1} ...)
                :g2 (m/seqable {:k !k :v !v2} ...)})
             [!k (m/app + !v1 !v2) ...])
I'd like the result to be [:a 2 :b 4 but meander is walking the two seqs independently. How do I get a join on :k ?

noprompt 2020-04-04T19:32:33.109900Z

(m/rewrite {:g1 [{:k :a :v 1} {:k :b :v 2}]
            :g2 [{:k :b :v 2} {:k :a :v 1} {:k :b :v 3}]}
  {:g1 (m/seqable !g1s ...)
   :g2 (m/seqable !g2s ...)}
  (m/cata [!g1s ... !g2s ...])

  [] []

  (m/with [%m {:k ?k
                :v !v}]
    [%m . (m/or %m !not-m) ...])
  [?k ~(reduce + !v) & (m/cata [!not-m ...])])
;; =>
[:a 2 :b 7]

noprompt 2020-04-04T19:33:39.110100Z

There are probably few other ways to do this.

noprompt 2020-04-04T19:37:56.110300Z

Again, this is another place where the zeta fold will come in handy.

markaddleman 2020-04-04T21:15:24.110500Z

Thanks!