This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-12
Channels
- # adventofcode (6)
- # beginners (148)
- # boot (5)
- # calva (1)
- # cider (10)
- # cljdoc (10)
- # cljs-dev (8)
- # cljsrn (10)
- # clojure (180)
- # clojure-dev (24)
- # clojure-europe (2)
- # clojure-finland (1)
- # clojure-italy (32)
- # clojure-losangeles (1)
- # clojure-nl (40)
- # clojure-spec (10)
- # clojure-uk (44)
- # clojured (4)
- # clojurescript (88)
- # community-development (33)
- # core-async (7)
- # cursive (19)
- # datomic (98)
- # duct (3)
- # events (1)
- # figwheel-main (10)
- # fulcro (62)
- # leiningen (23)
- # luminus (18)
- # off-topic (19)
- # pedestal (6)
- # re-frame (46)
- # reagent (21)
- # ring (17)
- # ring-swagger (3)
- # shadow-cljs (94)
- # slack-help (9)
- # spacemacs (14)
- # sql (1)
- # testing (4)
- # tools-deps (14)
if :my-attr is card-one, [:db/add 123 :my-attr "my-value"]
will only add a datom the first time
but since it is split into two related entities, i need to fix them to the same point in time no ?
the answer was:
(def price-history-for-underlying
'[:find ?price ?time ?tx
:with ?q ?und
:in $ ?sym
:where
[?und :underlying/symbol ?sym]
[?und :underlying/price ?price ?tx]
[?q :quote/underlying ?und]
[?q :quote/time ?time ?tx]])
it ensures that the ?und and the ?q that we select are "paired" together/, married together if you will, at a single point in time, namely at ?tx point in time.
it's conventional to mark history databases with $h
since they usually change the nature of a query substantially
In this case set-wise results will make it all work out but it's easy to imagine getting surprised by duplicates with some query changes
@m_m_m Your transaction must include one of the attribute that identifies the entity you want to update. https://docs.datomic.com/on-prem/identity.html
Hi, I'm having trouble finding which dependency to add to my project.clj
to complete the dev setup
notably requiring datomic.api like (require '[datomic.api :as d])
In the getting started the dependency is [com.datomic/client-pro "0.8.28"]
but it doesnt work when using (require '[datomic.api :as d])
, any pointer please?
Thanks!
Also doing bin\maven-install
then mvn install:install-file -DgroupId=com.datomic -DartifactId=datomic-pro -Dfile=datomic-pro-0.9.5786.jar -DpomFile=pom.xml
generate an error
my bad on windows you have to escape things, so the correct command is mvn install:install-file -DgroupId="com.datomic" -DartifactId="datomic-pro" -Dfile="datomic-pro-0.9.5786.jar" -DpomFile="pom.xml"
I'm on cloud:
export DATOMIC_ENV_MAP="{:env :local}"
(ion/get-env)
=> "{:env :local}"
... it does not get read as EDN. What am I missing?
does anyone know how to use a java.util.Date instance in a predicate expression clause: e.g.,
[(<= ?time $before)]
when $before is an instance of java.util.Date, I get the following error:
ClassCastException java.base/java.util.Date cannot be cast to clojure.lang.Symbol clojure.lang.Symbol.compareTo (Symbol.java:105)
Huh I just use the operators all the time. Where is $before from? It is named like a db
Not actually a spec/datomic question, but closely related. Do you have any tricks to alleviate some pain of "broken sugar" for long namespaces of a
... Datomic ident style naming convention where :datomic.client.protocol/response enumerated values are like :datomic.client.protocol.response/body, which breaks the sugar
other than "suck it up"?
This often eliminates most of let
map destructuring too.
(from this short sub-thread: https://www.reddit.com/r/Clojure/comments/8ousfs/namespaced_keywords_question/e0844vk)Namespaces are usually the solution to this. Clojure uses them. XML too. I have no idea if this notion of namespace will come to spec though.
But no I have no trick except to not do that for every single piece of data inside your system 🙂
the problem is that key namespaces don’t compose with the normal keyword operations. you can’t derive :datomic.client.protocol.response.error/status
directly from :datomic.client.protocol.response/error
yeah, but as soon as you have several origins for the "same" key-val, having short implicit ns for your app key, and long global ns for external key – is kinda e.g.:
:myapp/email
and :oauth2.gmail/email
(assuming ofc gmail ns would be much longer :) )
yeah, this is probably what I'm fishing for, @lilactown. some approach to juggle these "hierarchical"-but-not-really keywords
which does not break various destructuring sites, go-to-spec-definition in IDEs, etc. along the way
yeah. you can probably come up with a clever helper function for your s/def
’s, but it falls over when trying to destructure
speaking of destructuring: as soon as you have :foo/id
and :bar/id
in the same map – you often have to go w/o destructuring too :(
yeah. it’s really annoying how destructuring completely loses the keyword ns. merging maps is easy but tearing off data requires more work
well, I usually like tear off all my data in one place. but yes, it’s not exactly pushing us into the pit of success
and is "naming same things over and over again" which Rich hates so much in java signatures and pattern matching
which brings us back to forms explosion, when keyword's ns is long enough (take any from https://gist.github.com/dustingetz/e3d0650d903d95ffe1cab1b343cfa073 from same reddit thread):
:datomic.client.protocol.response/error