This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-07
Channels
- # announcements (27)
- # babashka (29)
- # beginners (280)
- # calva (34)
- # cider (4)
- # circleci (11)
- # cljfx (10)
- # cljsrn (1)
- # clojure (526)
- # clojure-dev (9)
- # clojure-europe (42)
- # clojure-finland (5)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-taiwan (2)
- # clojure-uk (14)
- # clojurescript (40)
- # clr (43)
- # community-development (5)
- # css (4)
- # cursive (7)
- # duct (82)
- # events (1)
- # fulcro (72)
- # garden (44)
- # hoplon (3)
- # java (40)
- # jobs (4)
- # juxt (1)
- # luminus (53)
- # meander (13)
- # off-topic (26)
- # pathom (14)
- # pedestal (3)
- # portal (2)
- # rdf (3)
- # re-frame (54)
- # releases (10)
- # remote-jobs (3)
- # sci (74)
- # shadow-cljs (47)
- # startup-in-a-month (5)
- # testing (9)
- # tools-deps (73)
- # vim (12)
You might be able to rewrite the pull query as a quoted pattern and then build an interpreter with it.
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.
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
Part of the reason I’m moving in the direction of using ~
like this is make it explicit where Clojure interop happens.
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)
fwiw, I like the general approach
does this mean that fns with multiple args will always get invoked through clojure.core/apply ?