This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-19
Channels
- # admin-announcements (2)
- # beginners (25)
- # boot (93)
- # cider (2)
- # clara (2)
- # cljs-dev (63)
- # cljsjs (3)
- # cljsrn (38)
- # clojure (142)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-czech (1)
- # clojure-dev (7)
- # clojure-greece (1)
- # clojure-russia (170)
- # clojure-spec (11)
- # clojure-uk (65)
- # clojurescript (46)
- # clojurex (1)
- # code-reviews (3)
- # cursive (11)
- # datomic (35)
- # euroclojure (6)
- # events (2)
- # flambo (2)
- # hoplon (115)
- # instaparse (11)
- # jobs (21)
- # jobs-rus (3)
- # lambdaisland (2)
- # off-topic (17)
- # om (35)
- # onyx (161)
- # planck (1)
- # protorepl (7)
- # random (1)
- # re-frame (31)
- # reagent (19)
- # ring-swagger (21)
- # rum (5)
- # spacemacs (3)
- # specter (25)
- # test-check (20)
- # testing (7)
- # untangled (2)
- # yada (50)
@flyboarder: @micha: @tbrooke: @alandipert: @jumblerg: that monday looks good to me too. in HKT it's monday to tuesday midnight for me if i calculate it well. does anyone knows a good app which can answer "12 pm EST on Monday 8/22 in HKT"?
@onetom I use google or wolfram alpha for data conversion
Yeah I wish the API didn't cost so much, I would use it everywhere lol
@flyboarder: what? the pro is 66USD and even the pro premium is just 120USD/year if it's that good, it totally worth it
how can i do a reset!
within a formula cell?
(cell= (when registration
(app.routes/change-tab! :success)
(reset! app.routes/current-qmap {:email email})))
this reads the current value of app.routes/current-qmap
which is a hash-map instead of resetting the qmap
cell (since it's dereffed by cell=
)
i could extract the reset!
into its own function just like i did with change-tab!
, but that's a bit annoying
(ah, i would need a dosync
too around those two mutations to trigger one calculation propagation only...)
what im trying to do is to go to a different view within my app when a response from an RPC call arrives, but also pass the result of that RPC call as URL parameters to my view
it allows me to directly address a view via a URL while developing, so i wouldn't need to trigger the corresponding backend call just to get the desired state
Hi @thedavidmeister sorry for the late reply. I stopped using it. :p I've gotten it to work though. Is there anything in particular you'd want to know?
@levitanong oh, just wondering about general advice
i suppose, why did you drop it and what are you using now?
I was trying it out and I liked it. However, I needed to be able to zoom and pan an ordinal axis (because I have a ton of categories) and d3 doesn't support that out of the box, and it needs a workaround. Plottable, being something that builds on d3 is less flexible, and I was too lazy to see if I could implement the workaround there. So instead, I used the basic d3.
ah sure
i’m literally drawing a line chart, lol
the plottable ones just looked nice with thedefault styles
@onetom i end up writing a separate function, i’d be interested if you find a different approach
Anyone using Cursive? Though I have my cells in a regular .cljs
file, they’re not resolved.
@onetom: you want to use a watch or the the formula function
(cell=
(when registration
(app.routes/change-tab! :success)
(~(partial reset! app.routes/current-qmap) {:email email})))
docs describing behavior of ~
and ~@
here: https://github.com/hoplon/javelin#formulas
the issue of course was that inside the cell=
body expression cells are automatically dereferenced, so you can't operate on the cell itself, only its dereferenced value
the ~
form causes the expression it's unquoting to be hoisted out of the formula expression and is evaluated when the cell is constructed, instead of when the cell updates
well, i did understand why it does not work. what i still don't understand whats wrong with:
(cell=
(when registration
(app.routes/change-tab! :success)
(reset! ~app.routes/current-qmap {:email email})))
to understand why it works is still as complex as the partial function, but aesthetically it's better
from runtime perspective which one is more expensive, a new cell or a new partial function?
these are great examples. should we include them into the javelin readme?
because what it says about the formula
function is rather minimal
probably the most we have out there about formula
is using it in JS http://adzerk.com/blog/2015/06/splint-functional-first-aid-jquery/
if you hand-craft your formula
function you can maybe prevent some unnecessary hoisting, but i really doubt it will make a difference
the "hoisting" is what i mean by pulling references out of the body like (cell= (+ a b))
--> ((formula (fn [x y] (+ x y))) a b)
@alandipert i read that about a year ago. great article. but all i remember from it is it's possible to use the cell concept directly from javascript
@onetom: right, the thing that makes it possible is formula
- since JS can't use cljs macros, only cljs functions
i keep finding myself using path-cell
but there is no good place/namespace where i could put it 😕
@alandipert
> you want to use a watch or the the formula function
i would, but the add-watch
has a too generic api and also there is too little docs about it in javelin, so from team work perspective it's not really good to use
@onetom: also i think my suggestion is bad, since the actions you want to do depend on 2 cells
like if you find yourself using reset in a formula, it might mean that there is a better refactoring where app.route/qmap
is itself a lens
@adamw yes, although email
was just (cell= (:user/email registration))
when i wrote this example
@micha: actually, is there an easy way to see parents, children & edge dependencies for a given cell?
alan made a graph visualization, we have been planning to add it to javelin for a long time
where parents => cells that depend on this cell, children => this cell's dependencies; edge dependencies => cells that change the dependencies of this cell, e.g. (if <edge dep> <cell dep1> <cell dep 2>)
@adamw there such an interface on cell
s:
cljs.core/IWithMeta
(-with-meta [this meta] (Cell. meta state rank prev sources sinks thunk watches update))
actually do cells have edge dependencies? In other words in my pathological example above. if edge dep
is true and cell dep 2
changes, does my cell get re-evaluated?
sources are the cells this cell depends on, sinks are the cells that depend on this one
the IWithMeta thing is just implementing that protocol on the Cell type, so you can have metadata on cells
@micha @onetom: take the following example:
(defc edge true)
(defc dep1 1)
(defc dep2 2)
(cell= (if edge dep1 dep2))
so here the value of our formula cell is 1, regardless of what dep2 is. In other words, if I reset!
dep2 it should not cause our formula cell to re-evaulatebut any other formula cell depending on your (cell= (if edge dep1 dep2))
cell wont recompute because its value hasn't changed
where would this behaviour cause issues?
if dep1
would be an expensive formula cell, its latest value is cached in it and it wont be recomputed anyway.
not if both dep1 and dep2 depend on the same leaves. Let's say dep1 is an approximation formula and dep2 is an expensive computation. With strict evaluation it actually doesn't make a difference, both dep1 and dep2 will get evaluated anyway. So we would need to make dep1 and dep2 non-cells, i.e., functions that get passed all dependencies as arguments. And then it works. But it means we can't abstract our control flow, we need to explicitly define segmentation as a destruction of dependency.
@onetom what is the contents of this path-cell
??
Seems to be from some kind of routing system, are you using a home grown routing system or another cljs library?
ah yea hoplon/ui has it’s own routing, no suggestions there unfortunately
@flyboarder the path-cell
thing creates a lens
@micha right, I was just thinking about what the routing data in the cell might be, if there was a better way to work with the data instead of path-cell
, but if it’s not from a routing lib then the direction I was going doesnt really matter