Skip to content

Cool project, couple of small issues #1

@maxrothman

Description

@maxrothman

Thanks for building Joinery! I've had a lot of fun playing around with it a little recently, it definitely opens up interesting possibilities. I ran into a couple of small issues while exploring it a little, I'm happy to separate them out into separate issues if you'd prefer.

First, modifications to the joined-map don't seem to stick when you follow joins:

(def db
  {:person/id {1 {:person/name "Calvin"
                  :person/friends [[:person/id 2]]
                  :person/pet [:pet/id 1]}
               2 {:person/name "Derek"
                  :person/friends [[:person/id 1]]}}
   :pet/id    {1 {:pet/name "Malcolm"
                  :pet/species :dog
                  :pet/owner [:person/id 1]}}})

(def jm (joined-map db))
(def jm2 (assoc-in jm [:pet/id 1 :pet/breed] :collie))
(= jm2 (get-in jm2 [:person/id 1 :person/pet]))
;; => false

I suspect this is because the assoc impl modifies m but not db?

Second, calling clojure.pprint/pprint on a joined map causes infinite recursion. I think that's probably fixable by implementing the simple-dispatch multimethod? This one cropped up for me because my editor pprints REPL outputs, I suspect that's a relatively common setup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions