I wrote a code like this
in order to verify if some expression contains a or c. Let's call these a end c variable to avoid.
I want to write down something more functional-flavoured: I declare
VariableToAvoid[_]:= False; VariableToAvoid[a|c]:= True.
and I would like to write a function which does the same as ConstQ neither writing all the variables to avoid inside it nor making VariableToAvoid function to build a list, which doesn't seem very much functional. I'm a bit stuck. Can anyone help me?
1) non functional method
which return False
2) functional method
ToAvoid[_]:=False; ToAvoid[a]:=True; ToAvoid[c]:=True;
Now I want to get the same result as above on the a generic expression, in this case CentralDot[a,c] without list the variable to avoid
of course this function must contain some ToAvoid applied to the compoment of the internal exprssion, but I do not know how