
3 Jun
2007
3 Jun
'07
9:03 a.m.
apfelmus:
Phlex wrote:
Donald Bruce Stewart wrote:
Imagine updating a node in a tree by just detaching and reattaching a pointer.
[1] [1] / \ / \ [2] [3] update node 5 [2] [3] / \ with value 7 / \ [4] [5] [4] *
and share the rest of the structure. Since the rest isn't mutable anyway, you can share all over.
That's precisely the thing i don't understand. In order to update node 3 with a new pointer, i need to mutate it, so i need to recreate it, and so on up to node 1.
Yes, that's correct, I think Dons shared a bit too much here :)
Spent too much time with zippers lately ;) -- Don