This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-18
Channels
- # architecture (33)
- # asami (1)
- # aws (1)
- # babashka (19)
- # beginners (48)
- # bristol-clojurians (1)
- # calva (5)
- # cider (12)
- # cljdoc (15)
- # cljsrn (7)
- # clojure (151)
- # clojure-europe (19)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-provo (4)
- # clojure-spec (9)
- # clojure-uk (21)
- # clojuredesign-podcast (28)
- # clojurescript (33)
- # core-typed (1)
- # cryogen (2)
- # css (6)
- # cursive (10)
- # data-science (1)
- # datomic (20)
- # events (3)
- # expound (72)
- # figwheel-main (5)
- # fulcro (43)
- # graalvm (6)
- # helix (1)
- # kaocha (13)
- # leiningen (2)
- # malli (1)
- # meander (93)
- # membrane (4)
- # off-topic (17)
- # pathom (6)
- # portland-or (5)
- # re-frame (25)
- # reagent (6)
- # reitit (7)
- # reveal (30)
- # shadow-cljs (25)
- # vim (2)
Hello
Can I do something better then this or-join
to create the ?in-cart?
value?
This do not look like right.
'[:find ?name ?in-cart?
:keys :item/name :item/in-cart?
:where
[?item :item/name ?name]
(or-join [?item ?in-cart?]
(and [_ :cart/item ?item]
[(ground true) ?in-cart?])
(and (not [_ :cart/item ?item])
[(ground false) ?in-cart?]))]
Full runnable example here
https://gist.github.com/souenzzo/ebd049a99443883ebab180ff019400baI was going to suggest get-else as another possibility, but the reference is in the wrong direction
or > and // and not
feels to nested. Not sure if there is some missing?
or any other function to help
'[[(item-in-cart? [?item] ?in-cart?)
[_ :cart/item ?item]
[(ground true) ?in-cart?]]
[(item-in-cart? [?item] ?in-cart?)
(not [_ :cart/item ?item])
[(ground false) ?in-cart?]]]
Rules can have the same name, then they will behave as a "or"? 😮 There is more examples/docs about this?
> Rules with multiple definitions will evaluate them as different logical paths to the same conclusion (i.e. logical OR). Here’s a rule, again from the Seattle example, which identifies communities that are “social-media”.
Am I doing something wrong? I want to retract all values of the group attribute:
(d/q '[:find ?group
:where [17592186048817 :group ?group]]
db)
=> #{[#uuid"5ede7e84-c6ac-4116-82d4-0f6dfae77b9d"]}
@(d/transact conn [[:db/retract 17592186048817 :group]])
Execution error (IndexOutOfBoundsException) at datomic.db.ProcessInpoint/inject (db.clj:2472).
Ah, ok, we are using an older version, thanks much
Yup, that was it, thanks again.