meander 2021-08-17

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?

this is an evolution of the idea in that example

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

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

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

@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

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

❤️ 2

Cool, I’m very interested in that direction

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

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

looks promising so far

that’s very exciting

any plans for supporting a datascript like schema as well?

doxa is intentionally schemaless

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

guess it can also be added on top later

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

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

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

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

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

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

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?”

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?

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

(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)

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

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

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

here's the bit about cata

and unfortunately, the best source for learning meander is tests