[Haskell-cafe] Re: I just don't get it (data structures and OO)
Donald Bruce Stewart
dons at cse.unsw.edu.au
Sun Jun 3 05:03:23 EDT 2007
> Phlex wrote:
> > Donald Bruce Stewart wrote:
> >> Imagine updating a node in a tree by just detaching and reattaching a
> >> pointer.
> >>  
> >> / \ / \
> >>   update node 5  
> >> / \ with value 7 / \
> >>    *
> >> 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 ;)
More information about the Haskell-Cafe