I am having problems defining recursion in a function I have wrote. I am not sure what is wrong here, it could merly be a syntax blunder.
Basically I want to define like I have done for the Not Expression that the And expression calls the method substitute again. But I am havig issues defining substititue twice for the two expressions And can take.
substitute :: Expr -> [(Variable,Expr)] -> Expr
-- ...
substitute (Not e) x = substitute e x
substitute (And e1 e2) x = substitute e1 x substitute e2 x ---- ?????
If I get And wright then the entire function will work. 🙂 Can anyone help?
Thanks
This should work:
But I’m not really sure if this is what you want. You need some other cases where
substitutedoes some real work.