Dear Riccardo,
On Sat, May 1, 2010 at 12:55 AM, Riccardo Manoni
<[email protected]>wrote:
> here i am again, i know, it's 1 may...but First, i want to take a moment
> to say thank you guys for all the answers i received until now. Second,
> i'm in trouble with the function RemoveSmallest used to delete a node
> from a tree. I'm talking about the function on the CTMCP book. That one:
>
> fun {RemoveSmallest T}
> case T
> of leaf then none
> [] tree(Y V T1 T2) then
> case {RemoveSmallest T1}
> of none then Y#V#T2
> --> [] Yp#Vp#Tp <-- then Yp#Vp#tree(Y V Tp T2)
> end
> end
> end
>
> i know that the -->text<-- give me the node with the smaller key but i
> don't understand how. Shouldn't the pattern -->text<-- be something like
> []tree(Y V T1 T2)? How can be the tree T1 matched with something like
> Yp#Vp#Tp?
>
Read carefully the case statement.
It's not T1 that is matched with Yp#Vp#Tp, but {RemoveSmallest T1} !
Cheers,
Raphael
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users