When I traverse a nested structure with a zipper, modify a node deep inside and want to get the whole updated structure back, each time I visit an ancestor node of the modified one, my make-node
function is unnecessarily called 3 times by the clojure.zip/next
function.
Reviewing the implementation of the next
function, I see that storing the result of (up p)
in a variable/binding would get me rid of the extra make-node
calls (and I have tested that it does).
I identified this issue in a Clojurescript REPL but it looks like it's present in the Clojure implementation, too.