I'm learning Oz, and was trying to run an example that I found in a book, it is about to simulate a full adder, but what I get is sum( ), so I do not know where the mistake, I would appreciate your help.
Here is part of the code:
fun {XorG X Y}
fun {$ X Y}
fun {GateLoop X Y}
case X#Y of (X|Xr)#(Y|Yr) then
{X+Y-2*X*Y}|{GateLoop Xr Yr}
end
end
in
thread {GateLoop X Y} end
end
end
proc {FullAdder X Y ?C ?S}
K L M
in
K={AndG X Y}
L={AndG Y Z}
M={AndG X Z}
C={OrG K {OrG L M}}
S={XorG Z {XorG X Y}}
end
declare
X=1|1|0|_
Y=0|1|0|_ C S in
{FullAdder X Y C S}
{Show sum(C S)}
AndG and OrG are similar to XorG.