This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-18
Channels
- # boot (42)
- # cider (26)
- # cljs-dev (6)
- # cljsrn (6)
- # clojure (119)
- # clojure-berlin (3)
- # clojure-dev (2)
- # clojure-nl (1)
- # clojure-russia (38)
- # clojure-spec (1)
- # clojurescript (44)
- # component (3)
- # cursive (1)
- # data-science (2)
- # datomic (19)
- # dirac (60)
- # emacs (12)
- # figwheel (2)
- # hoplon (13)
- # iot (4)
- # keechma (2)
- # klipse (38)
- # leiningen (5)
- # luminus (1)
- # lumo (1)
- # off-topic (6)
- # om (2)
- # om-next (4)
- # onyx (21)
- # perun (79)
- # reagent (32)
- # untangled (39)
- # vim (36)
- # yada (1)
are there any idiomatic ways to represent an ordered list in datomic? more specifically, a queue
either by adding a "position" attribute, or by using a linked list
@pesterhazy linked list? like here? http://jmhofer.johoop.de/datomic/2012/08/18/linked-lists-in-datomic.html
[{:db/id #db/id[:db.part/db], :db/ident :content/name, ...
{:db/id #db/id[:db.part/db], :db/ident :linkedList/head, ...
{:db/id #db/id[:db.part/db], :db/ident :linkedList/tail, ...
there’s also this, evaluating it now https://github.com/dwhjames/datomic-linklist
I keep indexes in a list in a separate attribute.
{:x/ys #{1 2 3}
:x/ys-order #{{:o/id 1 :o/idx 0}
{:o/id 2 :o/idx 2}
{:o/id 3 :o/idx 1}}}
but for queues linked list might be more suitable. I need to be able to swap/shuffle elements, so this :x/ys-order works for me
it also helps with recursive pull patterns, if you happen to have parent/child of the same "type".
also thought about serializing to EDN a vector of uuids. makes some things easier, but then it’s not queryable
also storing blobs is not efficient in Datomic
once they're getting a bit bigger