Fork me on GitHub
#hyperfiddle
<
2023-10-09
>
Can11:10:41

Hello, When I add this code block to my project then I get stale output error when I delete that part code the project works. It is strange because I used the same code in my other project this code is working without a problem I just added in this project extra datomic db here. What am I missing?

(def columns
  #js
          [#js {:name "Title", :selector (fn [row] (.-title row))}
           #js {:name "Year", :selector (fn [row] (.-year row))}])
;If you want to take a look that is my page's gist: https://gist.github.com/Bariscanates404/0813204149ba8b5a3c4e3fac46d75963

xificurC11:10:38

I guess this is a cljc file and the clj part failed to compile. Try wrapping the js-specific data in a #?(:cljs reader conditional

πŸ‘ 1
Can11:10:48

I tried restarting project I tried wrapping in cljc block Still same 😞.

Dustin Getz12:10:06

as peter says #js reader literal only valid in cljs (also valid in e/client)

Dustin Getz12:10:02

you also use it in β€˜(def data)’ not just columns

Can15:10:48

sorry I sent message on channel. Thanks for the help.

Can18:10:08

Resolved, thanks.

πŸ‘ 1
nivekuil20:10:18

in general what does it mean when you get can't process event - consumer is not ready when you call ! in observe for the initial value? the consumer I assume is the electric code that calls new on the flow returned by`observe` , but that should happen after observe is run, so the initial ! shouldn't do this since there are no consumers yet?

πŸ‘ 1
Dustin Getz20:10:19

it could be a backpressure issue, do you need m/relieve ?

Dustin Getz20:10:01

i.e. the flow has notified but electric has not pulled the value through yet, and another event has appeared

nivekuil20:10:18

ah, very possible

nivekuil20:10:20

so that's what relieve is for πŸ™‚

πŸ™‚ 1
Dustin Getz20:10:38

crash course in m/relieve: (m/relieve {} >x) – {} will drop the stale event on the floor, replacing it with new event (m/relieve conj >x) – [i think that type checks? i'm worried about the initial empty value] conj will build up a vector of events (i.e. a queue) for you to deal with it upstream and now it is your fault when you run out of memory sometimes you'll chain with (m/reductions) so you can have a discrete reducer stage with a reducing function that is guaranteed to see every event, and then m/relieve after that.

Dustin Getz20:10:14

here's a real world example of that

Dustin Getz20:10:45

that will return a set of presently depressed keys

nivekuil20:10:21

conj isn't associative though, even if there were an initial []

Dustin Getz20:10:58

its a reducing fn, i.e. (reduce conj [] [1 2 3])

Dustin Getz20:10:32

(reduce conj [] [1 2 3]) := [1 2 3]
(reduce {} nil [1 2 3]) := 3

Dustin Getz20:10:50

I think there is an initial value issue, i think you need to use m/reductions with conj to provide the initial value prior to the relieve

nivekuil20:10:35

The set of transferred values must form a semigroup with given function `sg` as the internal
binary operation, i.e. `sg` must be associative
maybe i'm dumb but I thought {} is associative because it always returns the rightmost value no matter what order it's applied, that can't be case for conj unless it's a set?

Dustin Getz20:10:58

what docstring is that

Dustin Getz20:10:10

semigroup is monoid but without the initial value, i.e. a reducing function as I understand it

Dustin Getz20:10:35

this is where you'd pass the diff operator for differential signals – you want the diffs to squash inside m/relieve as they build up

nivekuil20:10:28

isn't the idea for the associativity constraint that diffs can come in any order, like crdts

Dustin Getz20:10:33

i don't understand "sg must be associative" and it actually doesn't compile in my mind

Dustin Getz20:10:46

i think he means the semigroup's binary operator must be associative

nivekuil20:10:08

associative wrt to the collection, which conj is for clojure.core/sets?

Dustin Getz21:10:43

Yeah I must be mistaken, conj needs to be applied at the reductions stage before the relieve

Dustin Getz21:10:00

I don't actually understand why m/relieve cannot take a reducing function, and why conj has to be done at a prior stage

nivekuil21:10:42

I think the contract changed now that relieve is a differential primitive

Dustin Getz21:10:05

hm maybe, I dont understand the new associative requirement

Dustin Getz21:10:16

unclear if it's a new requirement or just the docstring was strengthened

nivekuil21:10:25

well he literally renamed rf to sg

Dustin Getz21:10:37

i understood the change to be backwards compatible

Dustin Getz21:10:26

i.e. i suspect it was an old requirement and the old docstring may have been unrigorous

Vincent22:10:42

Magma is math?

leonoel06:10:05

> i suspect it was an old requirement and the old docstring may have been unrigorous yes, that

πŸ™ 1
leonoel06:10:17

also conj is not associative, but into is

πŸ‘€ 1
nivekuil06:10:02

wow into even comes with brackets (into [1][2 3]) (into [1 2][3]) . I was struggling to figure out how to even denote associativity with prefix notation

πŸ‘ 1
leonoel06:10:31

> isn't the idea for the associativity constraint that diffs can come in any order, like crdts that would be commutativity

Dustin Getz10:10:38

@U797MAJ8M yes i was struggling too. Leo what is the conceptual reason for m/relieve not taking a RF?

leonoel11:10:39

it's not a reduction

Dustin Getz11:10:43

why can't it be

leonoel12:10:22

if it's a reduction, when does it start, when does it end, what is the initial value

Dustin Getz00:10:51

regarding using conj as a semigroup operator, it is also invalid because it is not β€œinternal” which is to say the inputs and outputs are not the same type

Dustin Getz00:10:58

ha we found him in literature review (i think? i forget exactly). looks like he’s put more work into it, there was just the 2019 talk when i saw him in 2020

Dustin Getz00:10:48

he probably found motivation by seeing our blog post in 2021