This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-27
Channels
- # beginners (34)
- # boot (15)
- # cider (7)
- # cljs-dev (7)
- # cljsjs (2)
- # cljsrn (46)
- # clojure (130)
- # clojure-argentina (1)
- # clojure-colombia (2)
- # clojure-greece (1)
- # clojure-italy (53)
- # clojure-losangeles (1)
- # clojure-russia (15)
- # clojure-spec (8)
- # clojure-uk (100)
- # clojurescript (117)
- # core-matrix (1)
- # cursive (24)
- # datomic (41)
- # duct (1)
- # emacs (11)
- # fulcro (22)
- # graphql (4)
- # hoplon (3)
- # jobs (1)
- # lein-figwheel (3)
- # luminus (18)
- # lumo (52)
- # off-topic (57)
- # pedestal (2)
- # planck (12)
- # re-frame (22)
- # remote-jobs (1)
- # ring-swagger (6)
- # rum (7)
- # shadow-cljs (13)
- # yada (19)
I was hoping to pass a variable sample size in to datalog sample function. But it's not having it. Is there anything obvious I am doing wrong ?
(d/q '[:find (sample ?size ?id) .
:in $ ?size
:where [_ :myns/main-id ?id]]
(d/db (d/connect "datomic:"))
1024)
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number
I could beat it to death with (defmacro
but I'd rather not if I can avoid it
perhaps its a hint that sample sizes are best hardcoded
I installed one datomic function to run as a "transaction function"
Then I "overinstalled" it. On (d/with db [[:my-fn]])
it runs the new version. On (d/transact conn [[:my-fn]])
runs the older version...
I'm asking if db
isn't the result of other d/withs rather than directly from (d/db conn)
I finded. requires
behaves like to-many
My wrong version was with 2 requires (one invalid require). Then I made a new one with just one require. But it still trying to import the wrong require
(let [db-uri "datomic:"
conn (do (d/create-database db-uri)
(d/connect db-uri))
fn-1 {:db/ident :my/fn
:db/fn (d/function {:lang :clojure
:requires '[[foo.bar] [datomic.api :as d]]
:code '(do "same-code")})}
{db-1 :db-after} @(d/transact conn [fn-1])
fn-2 {:db/ident :my/fn
:db/fn (d/function {:lang :clojure
:requires '[[datomic.api :as d]]
:code '(do "same-code")})}
{db-2 :db-after} @(d/transact conn [fn-2])
fn-3 {:db/ident :my/fn
:db/fn (d/function {:lang :clojure
:requires '[[datomic.api :as d]]
:code '(do "not-the-same")})}
{db-3 :db-after} @(d/transact conn [fn-3])]
{:fn-1 (:requires (:db/fn (d/entity db-1 :my/fn)))
:fn-2 (:requires (:db/fn (d/entity db-2 :my/fn)))
:bug? (= (:requires (:db/fn (d/entity db-1 :my/fn)))
(:requires (:db/fn (d/entity db-2 :my/fn))))
:fn-3 (:requires (:db/fn (d/entity db-3 :my/fn)))})
=>
{:fn-1 [[foo.bar] [datomic.api :as d]]
:fn-2 [[foo.bar] [datomic.api :as d]]
:bug? true
:fn-3 [[datomic.api :as d]]}
the functions don't compare equal in clojure or using query comparator, so I'm not sure what's up
I'm trying to find/recover my password at http://receptive.io 😄
(let [db-uri "datomic:"
conn (do (d/delete-database db-uri)
(d/create-database db-uri)
(d/connect db-uri))
{tx-1 :tx-data} @(d/transact conn [{:db/ident :my/fn
:db/fn (d/function {:lang :clojure
:requires '[[foo]]
:code '(do "same-code")})}])
{tx-2 :tx-data} @(d/transact conn [{:db/ident :my/fn
:db/fn (d/function {:lang :clojure
:requires '[[bar]]
:code '(do "same-code")})}])]
(assert (> (count tx-2) 1)))
I think the transactor, when comparing old and new fn values, is only looking at :lang
and :code
and ignoring :requires
and :imports
(let [db-uri "datomic:"
conn (do (d/delete-database db-uri)
(d/create-database db-uri)
(d/connect db-uri))
{tx-1 :tx-data} @(d/transact conn [{:db/ident :my/fn
:db/fn (d/function {:lang :clojure
:imports '[java.net.URI]
:code '(do "same-code")})}])
{tx-2 :tx-data} @(d/transact conn [{:db/ident :my/fn
:db/fn (d/function {:lang :clojure
:imports '[java.util.UUID]
:code '(do "same-code")})}])]
(assert (> (count tx-2) 1)))
bug #2 - Can't login/recover my password in http://receptive.io
Say, just out of curiosity has anybody managed to get datomic to run with localstack? https://github.com/localstack/localstack