meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
noprompt 2021-01-07T18:14:33.133600Z

You might be able to rewrite the pull query as a quoted pattern and then build an interpreter with it.

noprompt 2021-01-07T18:15:47.134500Z

Using the meander.interpreter.epsilon namespace. I can sort of imagine how to do it but I’m a bit in the weeds with some other things.

noprompt 2021-01-07T18:45:01.136700Z

On a separate topic, I’m interested in potentially slightly tweaking m/app in zeta (which I’m now making progress on based off existing work and the interpreter).

(m/apply fn-pattern args-pattern ret-pattern)
;; Query semantics
;; ---------------
;;
;; Target is applied to a function yielded by `fn-pattern` and
;; `args-pattern` without modifying bindings. The return value is
;; queried against `ret-pattern`.
;;
;; Example
;; -------
;;
;; (m/find 1 (m/apply ~clojure.core/+ [2 3] 6) true)
;; ;; => true
;;
;; Yield semantics
;; ---------------
;;
;; Yields the result of applying a funtion yielded by `fn-pattern` to
;; arguments yielded by `args-pattern` if the result successfully
;; queries against `ret-pattern`.
;;
;; Example
;; -------
;;
;; (m/generate (m/apply ~clojure.core/+ [2 3] _))
;; ;; => 5

noprompt 2021-01-07T18:46:47.138100Z

Part of the reason I’m moving in the direction of using ~ like this is make it explicit where Clojure interop happens.

noprompt 2021-01-07T18:51:39.142700Z

This has some similar motivations as project to do things a bit more safely than ~ is hackishly used for today.

(m/find [2 3 5]
  [?x ?y (m/apply ~clojure.core/+ [?x ?y] _)]
  true)
Instead of
(m/find [2 3 5]
  [?x ?y ~(+ ?x ?y)]
  true)

markaddleman 2021-01-07T19:08:27.144100Z

fwiw, I like the general approach

markaddleman 2021-01-07T19:24:29.145300Z

does this mean that fns with multiple args will always get invoked through clojure.core/apply ?

noprompt 2021-01-07T21:25:01.147700Z

For m/apply this would be the semantic. Separately, I was thinking we could have

(m/invoke fn-pattern arg-pattern* ret-pattern)
for the case where you don’t want to use clojure.core/apply.

noprompt 2021-01-07T21:25:25.148100Z

But, I’m still thinking about the semantics of these things.

noprompt 2021-01-07T21:26:18.149200Z

My thoughts about using ~ are really the most important ones.

noprompt 2021-01-07T21:26:22.149400Z

(To me.)

noprompt 2021-01-07T21:27:18.150500Z

(m/invoke ~(partial apply some-fn) ?x) could be just fine.

noprompt 2021-01-07T21:28:06.151800Z

I was noticing that I’m not really happy with

(m/app (partial apply +) [!xs ...])
on the right.