This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-12
Channels
- # admin-announcements (1)
- # aleph (1)
- # arachne (10)
- # beginners (6)
- # boot (81)
- # braveandtrue (3)
- # cider (42)
- # cljs-dev (1)
- # cljs-edn (52)
- # cljsjs (9)
- # cljsrn (9)
- # clojure (62)
- # clojure-austin (1)
- # clojure-belgium (11)
- # clojure-berlin (2)
- # clojure-gamedev (2)
- # clojure-greece (1)
- # clojure-russia (73)
- # clojure-uk (98)
- # clojurescript (156)
- # community-development (4)
- # component (3)
- # cursive (30)
- # datascript (10)
- # datomic (17)
- # emacs (5)
- # events (1)
- # hoplon (315)
- # jobs (1)
- # jobs-discuss (3)
- # lein-figwheel (6)
- # luminus (18)
- # off-topic (13)
- # om (130)
- # other-languages (122)
- # re-frame (32)
- # reagent (27)
- # rethinkdb (6)
- # ring (2)
- # ring-swagger (31)
- # spacemacs (4)
- # untangled (6)
- # yada (30)
nothing, carry on
learning datomic right now 😛
Is … is this magic?: :find ?composition-entity (distinct ?radical) ?author-name
does what I want: returns a seq of [id [list of radicals] author-name]
I feel like a noob again wondering how for loops work 🙃, because before, with just :find ?composition-entity ?radical ?author-name
, DataScript returned a big fragmented set of [id single-radical author-name]
vectors, and I thought I'd have to do a group-by
outside the query. But throw in a distinct
in there (I'm a big boy now, reading datomic docs) and I feel like the computer read my mind and gave me exactly what I wanted. Spooky.
How do I use transactor functions? I have a simple function that I want to call in a transaction, that for now just adds a new author
with a given name
: (defn my-trans-fn [db & [author-name]] [:db/add -1 :author/name (or author-name "test-1")])
. I've tested this function in a non-transactional way like so: (d/transact! conn [(my-trans-fn nil "foo")])
and it inserts a new entity as expected. Now, I'd like to call this inside a proper transaction, but (d/transact! conn [[:db.fn/call my-trans-fn "bar"]])
doesn't seem to be valid?
Do I need to "load" the transactor function into the db, like with Datomic? Do I need to quote my-trans-fn
somehow?
Holy cow, I magically landed on https://vimeo.com/114688970 at the right minute when Nikita started typing a transactor function! At 45:50 I see my problem: my function's returned vector needed another level of nesting, hmm