This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-18
Channels
- # announcements (26)
- # beginners (107)
- # calva (26)
- # cider (55)
- # clj-kondo (7)
- # clojure (115)
- # clojure-europe (6)
- # clojure-houston (3)
- # clojure-italy (4)
- # clojure-nl (16)
- # clojure-norway (1)
- # clojure-uk (42)
- # clojuredesign-podcast (3)
- # clojurescript (47)
- # clojutre (4)
- # cursive (7)
- # datomic (75)
- # fulcro (1)
- # graalvm (3)
- # graphql (16)
- # jobs (1)
- # jobs-discuss (13)
- # keechma (1)
- # leiningen (19)
- # luminus (5)
- # off-topic (33)
- # pathom (16)
- # re-frame (76)
- # reitit (4)
- # ring (5)
- # shadow-cljs (86)
- # spacemacs (52)
- # tools-deps (43)
- # vim (7)
- # yada (1)
Hey Datomic On-Prem currently requires JDK 7 or 8. Is this also true for the peer library? Can the peer library be used with the latest JDK?
I don’t know if this is supported but I have used the peer on jdk 11 without problems. (or maybe there were problems getting it to work but I’ve forgotten them and they are non-issues now)
(I probably encountered minor opposition and decided it was safer not to even try to work through it, but honestly I don’t remember clearly)
The peer or the transactor can run on jdk 11, or both?
Great, thank you
Did anyone happen to try and use the Github package registry to push the datomic-pro jar to their private repo?
I did and I'm failing to pull it back in with lein. I've asked Github for support
Haven't tried on github but we've got it published on a private S3 repo via mvn deploy-file
without too much trouble
@U08QZ7Y5S yeah I did that with other libraries too. This did result in AWS credentials in the project files as something else got too involved. I could probably do better here. Now I was hoping Github would be a nice alternative. Maybe it needs some time
Hi! I would appreciate help with the following: I have a composite tuple that includes 5 unique attributes and I want to add a new unique attribute. What is the correct way to do it?
The docs say that :tupleAttrs cannot be altered so the option would be to add a new composite tuple. I created one with the extra attribute, but the old one gets in the way.
[(get-else ?e :ref-attr ?not-found) ?v]
-> ?v
is your “:db/id” (if I understand your question correctly?)
The reverse form of an attr isn’t recognized in query clauses; reverse the clause order instead: [?v :attr ?e]
instead of [?e :_attr ?v]
Thanks, but reversing order makes me disappointed how to use get-else. I'l try you first suggestion
get-else only works on cardinality-one attributes; the reverse would be cardinality-many
(d/q '[:find [(count-distinct ?item)]
:in $
:where
[?o :order/pickup-items ?item]
[?r :recycle/items ?item]]
db)
=> [541]
(d/q '[:find [(count-distinct ?item)]
:in $
:where
[?o :order/pickup-items ?item]
; [?r :recycle/items ?item]
]
db)
=> [1561]
No. I want all 1561 items as a separate rows, but if item choosen also in recycle, I want its id, otherwise false by get-else or something similar
but if item doesn’t have a recycle, what would it be? {:item item-eid :recycles #{:default}}
?
`’[:find ?item ?o ?r :where [?o :order/pickup-items ?item] [?r :recycle/items ?item]]` if they have an item
unfortunately my query sufficiently complex, I typed a simple example above for only to show the problem
(d/q
'[:find ?i ?o ?r
:where
[?o :order/pickup-items ?i]
(or-join [?i ?r]
(and
(not [_ :recycle/items ?i])
[(ground false) ?r])
[?r :recycle/items ?i])
]
'[[o1 :order/pickup-items i1]
[o2 :order/pickup-items i1]
[o2 :order/pickup-items i2]
[r1 :recycle/items i1]
[r2 :recycle/items i1]]
)
=> #{[i2 o2 false] [i1 o1 r2] [i1 o2 r2] [i1 o1 r1] [i1 o2 r1]}
my other approach was call (d/datoms)
, perform a bounded count, and either destructure if nonzero or bind to your sentinel if zero
Hey! I can do (d/transact db {:tx-data some-map}) to add a map of data to my database. Is there a way to do the opposite? If I have some-map or stuff and I want to retract those from the database?
the map form of a transaction is purely syntactic sugar for a bunch of [:db/add ...]
clauses (which is what everything ultimately expands to. There’s no syntactic sugar for :db/retract
when you say {:db/id e :attr v}
in a tx, you are only adding assertions to the entity, you are not making the entity look like your map.
that said there are some transaction functions floating around which can make your entity “look like” the argument, i.e. do whatever adds/retracts are necessary atomically
here’s some I wrote a long time ago, I’m sure there are better ones now: https://gist.github.com/favila/8ce31de4b2cb04cf202687c6a8fa4c94
Okay copy copy. With that, let me give you a little more context. So I have a vector of vectors with 3 values in them. I was very easily able to zipmap keys into those vectors and turn them into a vector of maps, then boom I could add them to the database. Now I have that same vector of vectors and I want to instead retract that information from the database. Should I just put all that information through a function which returns [:db/retract ...] until I have a bunch of those?