Guest User

Untitled

a guest
Dec 10th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. This is a thought experiment, obviously this is not real datomic!
  2.  
  3. Why do this? I think it would cancel out data transformation boilerplate currently needed to do something like this.
  4.  
  5. ```clojure
  6. (defn user-uuid-to-user [user-uuid]
  7. (d/q [:in $ ?user-uuid
  8. :find ?user . ; no pull here, bind it later
  9. :where [?user :user/uuid ?user-uuid]]
  10. *$* user-uuid))
  11.  
  12. (d/pull $ [:domain/ident
  13. {:hyperfiddle/owners ; :many :uuid
  14. [{user-uuid-to-user ; a fn that navs deeper, takes uuid as input
  15. [:user/name ; now we can pull deeper as if the relation was a ref
  16. :user/email]}]}]
  17. [:domain/ident "tank"])
  18. ```
  19.  
  20. Someone who understands rules can probably make this simpler.
Add Comment
Please, Sign In to add comment