# Mystery with ValueQ

Consider the following

ClearAll[jd];
ValueQ[jd]


We expect False and get it. Now consider

ClearAll[jd];
ValueQ[jd /. {foo -> Unique[]}]


which yields True. But

jd /. {foo -> Unique[]}


is just jd and has no value defined. What's going on here?

• ValueQ[] is a funny beast. Try {ValueQ@E, ValueQ@Sin@E, ValueQ@Pi, ValueQ@Sin@Pi, ValueQ@N@Pi} :) Dec 25, 2013 at 19:10
• some related questions on ValueQ
– rm -rf
Dec 25, 2013 at 19:18
• According to the doc, "ValueQ gives False only if expr would not change if it were to be entered as Mathematica input.", so the Value in ValueQ does not mean numerical value I think. Dec 25, 2013 at 19:31
• See the definition for yourself: ClearAttributes[ValueQ, Protected]; ClearAttributes[ValueQ, ReadProtected]; ValueQ // Information; DownValues[ValueQ][[1]] /. {SystemDumps -> s, SystemDumph -> h} Dec 25, 2013 at 21:54
• So in your case we have (both give True): ! Hold[Evaluate[jd /. {foo -> Unique[]}]] === Hold[jd /. {foo -> Unique[]}], as ! Hold[Evaluate[jd]] === Hold[jd /. {foo -> Unique[]}] Dec 25, 2013 at 22:03

If, say, f has the HoldAll attribute, you should not assume f[2] to be the same as f[1+1]. ValueQ has such attribute.
ValueQ tests whether the expression changes upon evaluation.
jd /. {foo -> Unique[]} evaluates to jd which is different from the original unevaluated form jd /. {foo -> Unique[]}. Therefore, ValueQ[jd /. {foo -> Unique[]}] gives True