meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
2019-12-11T18:55:54.467900Z

I'm using meander to scan the results of a regression test execution. I'd like to report the count of successful test executions. My strategy is to filter for successes and then somehow group them to count but I can't figure out how to group within meander. Currently, I have:

(m/search regression-suite
                (m/and
                  (m/scan {:regression-test-success? true})
                  !success-test-records
                  (m/let [?count (count !success-test-records)]))
                (count !success-test-records))
This is obviously wrong and I think I understand why but there's something about memory variables that I'm missing...

noprompt 2019-12-11T18:58:25.469300Z

m/gather can do that @mark340

noprompt 2019-12-11T18:58:54.470Z

(m/gather {:regression-test-success? true :as !success-test-records} ?count)

noprompt 2019-12-11T19:02:44.470500Z

Hmm… I’m trying that out and am surprised its not working.

noprompt 2019-12-11T19:02:56.470700Z

Oh wait, whoops.

noprompt 2019-12-11T19:02:59.471Z

Made a typo.

noprompt 2019-12-11T19:03:31.471400Z

(let [data (map hash-map
            (repeat :regression-test-success?)
            (cycle [true false]))
      regression-suite (take 10 data)]
  (m/find regression-suite
    (m/gather {:regression-test-success? true
               :as !success-test-records}
              ?count)
    [!success-test-records ?count]))
;; =>
[[{:regression-test-success? true}
  {:regression-test-success? true}
  {:regression-test-success? true}
  {:regression-test-success? true}
  {:regression-test-success? true}]
 5]

noprompt 2019-12-11T19:04:01.471800Z

search will return more results than you want for this case.

noprompt 2019-12-11T19:04:43.472100Z

Also, I thought we had a docstring for gather too. 😕

jimmy 2019-12-11T19:08:42.472500Z

I can write one tonight.

2019-12-11T19:09:03.472600Z

This is just a hot-take, without ever seeing gather before, but I find it odd that :as !name is included in the same map as the pattern. Am I reading that right?

noprompt 2019-12-11T19:18:47.472800Z

@d4hines Yes, you’re reading that correctly, its to have parity with the familiar :as from clojure destructuring. We plan to make that a qualified keyword in zeta , however.

noprompt 2019-12-11T19:19:19.473Z

I suppose we could have ::m/as be thing for epsilon as well but I’m not a big fan of having two keywords.

2019-12-11T19:21:40.473300Z

Ok, that makes more sense. I wasn't making the connection to destructuring, but with that in context it makes more sense.

2019-12-11T19:22:50.473500Z

I agree it should be a namespaced keyword in another version.

2019-12-11T19:23:17.473700Z

I also agree supporting two keywords in a single version isn't worth it.

2019-12-11T19:27:27.474Z

Thanks for pointer to gather! I figured that doc entries without doc strings were internal functions.

jimmy 2019-12-11T20:58:07.474300Z

We have (to the best of my knowledge) hidden the internal functions from showing up the docs.

2019-12-11T23:02:02.474500Z

Good to know. Thx!