Im writing a code for an exercise for my uni and have a problem. I'm quite beginner with Oz and just can't figure out why does this code not showing anything but is accepted by the compiler:
declare Tree W P T1 T2 T3 T4
fun {Count0 Tree}
case Tree.subT of nil then
if Tree.value==0 then
1
else
0
end
[] H|T then
if Tree.value==0 then 1+{Count0 T}
else
0+{Count0 T}
end
end
end
in
T1 = tree(value:0 subT:nil)
T2 = tree(value:0 subT:[T4])
T3 = tree(value:0 subT:nil)
T4 = tree(value:0 subT:nil)
T0 = tree(value:W subT:[T1 T2 T3])
{Browse {Count0 Tree}}
The code should count number of '0' in value of a tree and all of his subtrees that are in the list in tree.subT and in those trees and so on.
I'll be very grateful for any help!