This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-17
Channels
- # admin-announcements (3)
- # beginners (15)
- # boot (5)
- # cider (25)
- # cljs-dev (9)
- # cljsjs (5)
- # clojure (30)
- # clojure-belgium (20)
- # clojure-boston (1)
- # clojure-greece (1)
- # clojure-japan (3)
- # clojure-russia (17)
- # clojure-uk (2)
- # clojurescript (49)
- # clojurewerkz (2)
- # cursive (5)
- # datomic (1)
- # emacs (1)
- # euroclojure (1)
- # hoplon (155)
- # jobs-discuss (17)
- # mount (6)
- # off-topic (1)
- # om (87)
- # proton (2)
- # re-frame (3)
- # remote-jobs (4)
- # spacemacs (2)
- # untangled (12)
What are people's approaches to modeling sum (aka union) types in datomic?
In clojure you can have a single key map, with the key as type. For datomic I thought of the following way:
Have attributes :my-sumtype/string
and :my-sumtype/int
.
To know which one it is, test the attribute for existence (this might be a problem if the type changed over time from e.g. int to string, both will exist, maybe use retraction?)
Attach this sum entity to other entities via a ref.
Are there better ways?