This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-10
Channels
- # aleph (1)
- # aws-lambda (1)
- # beginners (80)
- # boot (20)
- # cider (75)
- # cljs-dev (45)
- # cljsjs (1)
- # cljsrn (11)
- # clojure (428)
- # clojure-dusseldorf (13)
- # clojure-italy (4)
- # clojure-russia (153)
- # clojure-spec (47)
- # clojure-taiwan (1)
- # clojure-uk (62)
- # clojurescript (84)
- # cursive (19)
- # datascript (96)
- # datomic (75)
- # dirac (9)
- # docs (3)
- # emacs (19)
- # jobs (5)
- # jobs-discuss (20)
- # jobs-rus (17)
- # lein-figwheel (5)
- # leiningen (1)
- # liberator (4)
- # luminus (12)
- # off-topic (4)
- # om (31)
- # onyx (102)
- # pamela (1)
- # parinfer (3)
- # pedestal (3)
- # proton (1)
- # protorepl (14)
- # re-frame (54)
- # reagent (22)
- # rum (40)
- # spacemacs (2)
- # specter (8)
- # test-check (5)
- # unrepl (110)
- # untangled (80)
- # vim (3)
- # yada (46)
ds.db_with(State.db, vector( hashMap(":db/ident", "history" , ":history/location", mori.conj(toClj(removeNull(history.location)), hashMap(":db/ident", "location")))))
value of attribute :history/location is saved as a hashMap in datascript instead of being breaken up into datoms. even though :history/location is specified as a reference
tried to do State.update(ds.db_with(State.db, vector( hashMap(helpers.keywordize(":db/ident"), "history" , helpers.keywordize(":history/location"), mori.conj(toClj(removeNull(history.location)), hashMap(helpers.keywordize(":db/ident"), "location"))))))
personally, i don't even understand why it is trying to compare it, but both are strings, so it should be able to compare it
and i remember this same exact error message from a year ago and it was driving me crazy back then too 😞
which one? 🙂 right now i can't use namespaces, but it might be because something weird from https://github.com/typeetfunc/datascript-mori
if i do keywordize(":history/location") and schema_to_clj(schemajson), with :history/location specified as a reference attribute in the schema, it doesn't work in the sense that hashmaps under that attribute do not get flattened
if instead i use some random string that is not :x/y but x_y, and everything the same, it works
i gave the link... https://github.com/typeetfunc/datascript-mori/blob/08a08e14ba2b899eb518ebef79843a476d238b5e/src/datascript_mori/core.cljs
it’s hard to figure out because all those are your own helpers that can do whatever. E.g. we have no guarantee they support namespaces
my advice for you is to print everything you try to put into the database with pr-str
and see what are you really passing in
history.location is just a simple js object, removenull removes all properties with null values so datascript doesn't complain
well actually if you’d use datascript-js you won’t have to convert everything to CLJS objects
it must’ve been a pain to write code like that State.update(ds.db_with(State.db, vector( hashMap(helpers.keywordize(":db/ident"), "history" , helpers.keywordize(":history/location"), mori.conj(toClj(removeNull(history.location)), hashMap(helpers.keywordize(":db/ident"), "location"))))))
what the result of this looks like? vector( hashMap(helpers.keywordize(":db/ident"), "history" , helpers.keywordize(":history/location"), mori.conj(toClj(removeNull(history.location)), hashMap(helpers.keywordize(":db/ident"), "location")))))
ok, so when i print vector() or any cljs datastructure, i have to use toJs on it, otherwise it's just the ugly thing
found this? https://github.com/swannodette/mori/blob/46c9194b3c4bc93fc4b402925b9417add3b0a3ba/resources/chain.cljs#L176
thanks again @misha for your help. i used your suggestions and now stuff makes a bit more sense and i feel it's less hackish 🙂
btw, tonsky , regarding how painful code writing can be, i don't believe that writing is too painful, reading is much worse 🙂
for example i wrote this once http://ashnur.github.io/async-hell/#Behold-the-Pyramids-of-Doom