I'm attempting to write a substitution function but am having trouble figuring out how to fix the Error:
operator and operand don't agree [circularity]
operator domain: ''Z list * ''Z list * ''Z list
operand: ''Z list * ''Z list * ''Z
in expression:
sub2 (x,y,hd z)
Code:
fun sub2(x, y, z) = (
case z of nil =>nil
| Int => if(x = z) then y else z
| List => (sub2(x, y, (hd z))) :: (sub2(x, y, (tl z)))
);
Any help understanding what is causing this and how to fix it is greatly apreciated.