This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-29
Channels
- # beginners (14)
- # boot (83)
- # cider (13)
- # cljsrn (4)
- # clojure (240)
- # clojure-argentina (1)
- # clojure-berlin (2)
- # clojure-canada (1)
- # clojure-dusseldorf (1)
- # clojure-greece (2)
- # clojure-india (2)
- # clojure-japan (2)
- # clojure-russia (23)
- # clojure-taiwan (2)
- # clojure-uk (12)
- # clojurescript (138)
- # cursive (6)
- # datomic (36)
- # hoplon (245)
- # jobs-discuss (35)
- # lein-figwheel (4)
- # melbourne (2)
- # off-topic (1)
- # om (26)
- # om-next (2)
- # onyx (23)
- # proton (8)
- # quil (1)
- # re-frame (9)
- # ring-swagger (2)
- # untangled (10)
- # yada (6)
Anyone here have any ideas for using attrs
as a formula cell in the example below?
(defelem thing [{:keys [a b c] :as attrs} _])
@levitanong: what do you mean?
@dm3: in here, a, b, and c are cells.`attrs` is not a cell.
(cell= attrs)
results in nested cells
(cell= [a b c])
of course returns what i want.
oooooh! thanks @dm3! This is exactly what I’ve been looking for
look https://github.com/dm3/hoplon/commit/e51cda160a72f7522e0b94a3136e3b7a31bf2fac for some docs
@levitanong: actually with defelem+
you can't have :as attrs
at all
I'd think doing something like (and (.-parentNode elem) (.removeChild this elem))
is sensible
Oh dear
if i have #{[1] [2] [3]}
what is the nicest way to get something like [1 2 3]
?
ah cool
sometimes it’s best to ask
i usually avoid flatten because it works recursively, ie it flattens all depths
i tend to use (mapcat identity #{[1] [2] [3]})
or (apply concat #{[1] [2] [3]})
do you know if datascript ships with something?
seems pretty common to want to grab a list of ids/values that match some criteria
'[ :find ?list-id :where [_ :item/list-id ?list-id]]
another thing to look at is the "pull" syntax
which gives me #{[1] [2] [3]}
so how do i ask for just [1 2 3]
?
although you need to declare :item/list-id
as indexed in the schema for it to get into the AVET index
i made it :db.type/ref
should that do it?
closer i think?
#object[datascript.btset.Iter]
aaah yeah, so i just get all the ids
then i convert to a set to get rid of dupes, then back to a vector, which is what i want
actually i think that helps with something else i was doing too
so i had
(j/cell=
(->
(d/q '[ :find ?list-id
:where [_ :item/list-id ?list-id]]
state/conn)
sort
flatten
vec))
now just
(j/cell= (->>
(d/datoms state/conn :avet :item/list-id)
(map :v)
set
vec))
thanks all
very nice
@alandipert: also, i figured out a way to do sort-of event delegation
that’s obvious in hindsight
you can just let the event bubble out of the tpl, then catch the relevant info in a cell, and have a cell= inside your tpl reference that cell
aaah, i found a way to make something else simpler with the datoms thing
@micha - I've updated the #106 issue some more: https://github.com/hoplon/hoplon/issues/106
if you put a try/catch in that critical section then the v8 compiler can't optimize the entire function
maybe that really should be an error, because it will cause tons of problems in your application if you do that kind of programming
erlang does it by not allowing it
which is not really doing it lol
Always so exciting when I see someone typing 😛
https://github.com/hoplon/hoplon/wiki/Template-Macros summarized yesterdays explanation of cell conditionals, feel free to expand past my limited knowledge 😛
sweet!
@levitanong: agreed :thumbsup:
@flyboarder: Nice! I think that maybe they should be called Template Macros instead, as, people might think these have more to do with javelin
Good point!
Just added a list of available template macros for reference
Also clarified that cache doesn’t mean the template gets outdated at all
simply that they aren’t rebuilt
i think we should delete this page
because..
reasons.
Ballin’, amirite?
i was thinking that maybe i was overcomplicating things, since removeChild happens relatively rarely in hoplon world
then skipping jQuery (.remove)
may be fine, if someone was smart enough to remove the element on remove
so we definitely don't want to call .remove then if the thing isn't in the right parent
im not sure it is always safe, im seeing issues where semantic ui hides things outside of the dom (for animating), not working when used in hoplon-land
Hey guys just wanna say thanks for all the work on hoplon and documentation these days! One thing: on the API documentation page, the section on Destructuring Syntax seems awkard to me: https://github.com/hoplon/hoplon/wiki/API-Documentation#destructuring-syntax Isn't the defelem destructuring just normal clojure destructuring except it allow key/value pairs or a map as the first "arg"? That section seems to imply that there's a bigger difference. I could polish it up a bit