Fork me on GitHub
#meander
<
2021-08-17
>
mkvlr08:08:12

hi @huxley, really love your meander datascript example. Curious if you or anybody else ever profiled it against datascript? Or how it compares in terms of CLJS bundle size?

ribelo09:08:17

this is an evolution of the idea in that example

ribelo09:08:02

boundle size is basically zero, because the meander is macro-based and very little code is added

ribelo09:08:00

this is from a small project using a re-frame and a doxa. all for about 3kloc

ribelo09:08:31

all subscriptions use doxa queries, which means meander in total. @U5H74UNSF

mhuebert10:08:35

@huxley looks great. So doxa/meander is fast enough that using subscriptions to recompute queries whenever the root map changes is fast enough - no need for something like pattern-matching on a tx-log of changes to invalidate queries

ribelo10:08:09

@U050RLRRQ Yes, it's fast enough, but I'm actually working on what you're talking about

❤️ 6
mhuebert10:08:35

Cool, I’m very interested in that direction

ribelo10:08:55

underneath I use editscript, to calculate the difference in db, it is fast enough and its overhead is ~1ms

ribelo10:08:13

I want the queries to be memoized and recalculated only when the data that affects the result changes.

ribelo10:08:31

looks promising so far

mkvlr20:08:19

that’s very exciting

mkvlr20:08:34

any plans for supporting a datascript like schema as well?

ribelo20:08:22

doxa is intentionally schemaless

ribelo20:08:23

however, there is no problem adding it, but it would be far down on the list of things to do

mkvlr20:08:44

guess it can also be added on top later

mkvlr20:08:07

what is on the top of the list besides memoized-query?

ribelo20:08:22

Currently q is based only on meander, the consequence of which is that it expands on runetime

ribelo20:08:12

datascript simply takes a vector that can be sent, stored, or generated etc

ribelo20:08:57

currently, apart from me, only one other person is using doxa, and he is actually giving it direction by sharing ideas

steveb8n22:08:45

that’s me. I can confirm that Doxa works very well in a re-frame app. looking forward to trying out the new caching feature

steveb8n22:08:09

I’ll have an OSS project out soon with the Doxa/re-frame combo in use

Max14:08:27

When matching against a map, is there a way to capture all of the unmatched kvs? For example, imagine I have this input structure:

{:foo "a", :bar "2", :baz :ping}
And I want to transform it into:
{:foo "a", :bar 2, :baz "ping"}
but I don’t want to have to explicitly account for :foo. I guess this question could be rephrased as, “can meander be used to work with open maps?”

Max14:08:18

That requires you to pass the extra kvs along manually though, which means you’d have to remember to do it if you want your maps to be open. There’s not a way to do something like that semi-automatically, is there?

ribelo15:08:54

I guess I didn't understand the question at first.

ribelo15:08:56

(m/rewrite {:foo "a", :bar "2", :baz :ping}
  (m/map-of !ks (m/cata !vs))
  {& [[!ks !vs] ...]}
  (m/pred keyword? (m/app name ?k))
  ?k
  (m/re #"\d+" (m/app #(Long/parseLong %) ?v))
  ?v
  ?x ?x)

ribelo15:08:10

;; => {:foo "a", :bar 2, :baz "ping"}

Max16:08:55

Is cata documented anywhere? I couldn’t find it in the cljdoc

Max16:08:18

Seems like open maps are technically supported, but not super straightforwardly

ribelo20:08:44

here's the bit about cata

ribelo20:08:21

and unfortunately, the best source for learning meander is tests