We all know that Rich uses the perfect tree-based hash method to implement persistent data structures in Clojure. This structure allows us to manipulate persistent data structures without much copying.
But it looks like I can't find the right way to serialize this particular structure. For instance:
(def foo {:a :b :c :d})
(def bar (assoc foo :e :f))
(def bunny {:foo foo :bar bar})
My question is:
How can I serialize bunnyso that the content foo, i.e. did :amatching with :band :cmapping to :dappear only once in serialized content? This is similar to resetting the memory image of structures. It also looks like the serialization of the “internal nodes” as well as the “leaf nodes” referred to here .
PS In case this matters, I create a large DAG (directed acyclic graph), where we are assocpretty little to associate these nodes with these nodes and want to serialize the DAG for subsequent de-serialization. The extended graph representation (i.e., the content that will be obtained when printing DAG in repl) is unacceptably longer.
source
share