i have datatype expression defined.
datatype 'a expression = Not of 'a expression
| Or of 'a expression list
| And of 'a expression list
| Eq of 'a expression list
| Imp of 'a expression * 'a expression
| Var of 'a
| True | False;
And i need to implement function of this type
getVars (= ''a expression -> ''a list) goal of this function is to return all Var values in list.
Here is an example of function return.
- getVars (Eq [Var "A", Var "B", Imp (Var "D", Not (Var "Q")), Var "D", Var "B"]); val it = ["A","B","D","Q"] : string list
I have no idea how to implement that. Give me some advice plz.