Fork me on GitHub
#hoplon
<
2016-08-08
>
syk0saje04:08:34

hey all. does anyone here have experience adding testing to a hoplon backend? or should it just be enough to have an additional task that includes src files for testing?

micha04:08:25

seems like that should work

micha04:08:40

i just always include the test namespaces anyway

micha04:08:50

so there isn't a special task or anything

syk0saje04:08:14

alright, thanks!

syk0saje04:08:36

i think i'll need to make a separate task though, just so a boot test can be done externally

micha04:08:45

yeah could be

adamw07:08:41

Hi guys - sorry, some probably really obvious javelin questions that I'm struggling with: 1. How can I create a formula cell that depends on values of a set of anonymous cells passed in? Something like:

(defc a {})
(defn a-acc [t] (cell= (get a t)))
(defn grid [cs] (cell= (js/console.log (apply + cs))))
(grid cells (map a-acc [:a :b :c :d]))

adamw07:08:16

^ this fails with Error: No protocol method IAttr.-dom-attribute defined for type javelin.core/Cell: [object Object](…)

levitanong07:08:02

Does the cell a ever get populated with data?

adamw07:08:16

2. If I have a converging cell in the graph (like the cell= returned from grid; and I update a, does grid get executed n times for the number of cells defined by a-acc or just once?

adamw07:08:54

@levitanong: yes subject to user input somewhere. I should probably make a-acc (cell= (get a t 0)) to stop a null pointer exception

levitanong07:08:49

Can you talk a little more about the background behind what you’re trying to do? I almost never have to make a function that returns a cell.

levitanong07:08:01

For example, what I would do is this:

(defc a {})
(defc= a-vals (map #(get a %) [:a :b :c :d]))
(cell= (println (apply + a-vals)))

adamw07:08:42

@levitanong: so I'm trying to wire up a real spreadsheet (hoho). Basically I want to create n cells on the fly corresponding to the individual spreadsheet cells, so basically I have a function that creates a lens for each cell in the spreadsheet. Each spreadsheet cell would is built from 3 places; a javelin/cell containing a set of values, a javelin/cell containing a set of formats, and a javelin/cell containing a possible set of override values that should be displayed instead of the value in <values>.

adamw07:08:15

I could combine this all into one map like a-vals, but then every cell would get recomputed whenever, say, one override cell changes, which is very wasteful.

adamw07:08:31

So I would rather generate n cells corresponding to each spreadsheet cell

adamw07:08:45

which minimizes ticks, at the expense of making the graph larger

levitanong07:08:58

I think in this case, you should wait for someone like @micha or @laforge49

dm308:08:32

@adamw: I think you need to use formula function in order to create cells dynamically

adamw11:08:30

re q2; this talk by @micha answers it; rule 3 'Side effects occur at most once per event' https://www.youtube.com/watch?v=UoZyyo2Bwr8

dm311:08:44

the formula cells trigger when any of their dependencies values change, I believe

dm311:08:19

there's a special javelin.core/dosync that you can use to change multiple cells in one "transaction"

adamw11:08:37

#dm3 I was thinking of one input cell which is referred to by n formula cells, and a final formula cell which uses those individual formula cells.

adamw11:08:52

I was concerned that the final formula cell would be updated n times even though we only set one input cell

adamw11:08:01

but it seems that it will only be executed once

dm311:08:08

it should be just once

dm311:08:26

IIRC it goes through all cells according to their rank

adamw11:08:32

which is a good thing

dm311:08:34

when propagating updates

dm311:08:09

so updates to cells with lower ranks will be done when you get to the "deepest" formula cell

adamw11:08:19

yep, it constructs a final ordering and then executes the propagation

adamw11:08:42

javelin just gets better and better 🙂

adamw11:08:27

that talk should be referred to from the Javelin readme.md 🙂

dm311:08:48

hehe, I love it

dm311:08:42

it's crazy

alandipert14:08:35

i worked with a guy obsessed with comonads once

alandipert14:08:36

it was not fun

dm314:08:28

I guess if you have a PhD in type theory it's all intuitive

alandipert14:08:15

this guy wasn't a phd, just very enthusiastic

alandipert14:08:26

which is worse 😉

alandipert14:08:54

working with both monads and comonads i always get the feel that they are poor substitutes for a right data structure

alandipert14:08:06

at least when working with anything other than effects

alandipert14:08:52

> -- | This is a bit like taking the smash product of pointed topological spaces.

dm314:08:07

it's state of the art when you're looking at type theory research applications

dm314:08:55

just not compatible with how I want to do programming

dm314:08:54

were you working in a strongly typed language at that time?

dm314:08:04

err, I mean statically

alandipert14:08:38

no it was clj, which was part of the "problem"

dm315:08:21

oh, that's horrible