ValueQ
returns True
when for example on the following test (from a clean kernel with no assignments to f
):
test := Module[{a = 1}, ValueQ[f[a]]]
I guess this is because a
gets replaced in f[a]
. This is not the behavior I want. Is there an easy way to get more intuitive version of ValueQ
that checks whether there is a value for f["evaluated form of arguments"]
. (Possibly unless f has a holdall attribute but it is not important.)
I tried alternative versions of valueQ
that try to avoid the evaluation of the the argument of ValueQ
as described in https://mathematica.stackexchange.com/a/1484/45020 and https://mathematica.stackexchange.com/a/1485/45020, but they don't produce the behavior I want either.
I don't care much about leaking of the argument of ValueQ but would prefer the whole expression f[args]
to not be evaluated since it is slightly cleaner (it might be expensive to evaluate).
f
Have an assigned value in your code? If so, what is it? $\endgroup$