If I start with a symbol q
that I've assigned a value to,
q = 0;
and one, x
, that I haven't, I get different answers from ValueQ
depending on how I call ValueQ
. If I map ValueQ
over a list,
Map[ ValueQ, {q,x} ]
Mathematica returns {False, False}
. If I apply ValueQ
directly, however,
{ValueQ[q], ValueQ[x]}
Mathematica returns a different answer, {True, False}
. I've tried
{Names["q"], Names["x"]}
which returns {{q},{}}
before evaluating the two ValueQ
calls, and {{q},{x}}
after the calls. There's obviously some sort of side effect from the call to ValueQ
taking place behind the scenes. If I quit the kernel to start with a clean slate each time, however, and reverse the order in which I call the two versions (Map
or no Map
) I get the same results.
This is troubling behavior. What's going on?
I'm using Mathematica 11.0.1.0 on Linux x86 (64-bit).
ValueQ
. The effect I suppose is concerned withHoldAll
attribute ofValueQ
, so thatValueQ/@Unevaluated[{q, x}]
gives right answer{True, False}
. $\endgroup$