The function ValueQ has been irritating me for a while. I can't find its use for anything. Inspect the following:

b = 1;
c = "c";
DetermineIfValueAssigned[x___] := Table[ValueQ[{x}[[i]]], {i, Length[{x}]}];
DetermineIfValueAssigned[a, b, c]

Expected Output:


Instead, returns Output:


However, ValueQ[a] by itself does return the expected False.

What's going on here that can be re-implemented to obtained the wished results?

  • 1
    $\begingroup$ While ValueQ can be tricky it looks like your function construction is the problem here. $\endgroup$
    – Kuba
    Commented Mar 27, 2018 at 10:37
  • $\begingroup$ @Kuba How so? Consider this other example: {InputField[Dynamic[x], String, ContinuousAction -> True], Dynamic@ValueQ[x]}. Doesn't work neither. $\endgroup$
    – useranonis
    Commented Mar 27, 2018 at 10:39
  • $\begingroup$ {x}[[i]] - this is rather expected to change, isn't it? $\endgroup$
    – Kuba
    Commented Mar 27, 2018 at 10:40
  • 2
    $\begingroup$ Please do not use the bugs tag unless any behavior you've observed has been confirmed to be a bug. $\endgroup$ Commented Mar 27, 2018 at 10:40
  • $\begingroup$ @Kuba ValueQ\@{a,b,c} is not allowed... $\endgroup$
    – useranonis
    Commented Mar 27, 2018 at 10:41

1 Answer 1


If ValueQ[a] returns expected output and your function does not, how come have you decided to blame ValueQ?

There are two problems.

You don't prevent b or c from evaluation so before they get to ValueQ they are already evaluated to 1 and "c".

You need to be more careful with what you put in ValueQ. If you have ValueQ[{x}[[i]]] it will clearly change to anything that is in {x}.

b = 1;
c = "c";

foo // Attributes = {HoldAll, Listable};
foo[x___] := foo[{x}]
foo[x_] := ValueQ[x]

foo[a, b, c]

{False, True, True}

Listable may not fit your general use case well so here is a way without it:

foo // ClearAll
foo // Attributes = {HoldAll};
foo[x_, rest__] := Flatten@{ValueQ[x], foo[rest]}
foo[x_] := {ValueQ[x]}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.