I found a kernel function which is undocument MatchLocalNameQ.But I don't know the purpose of it.

a = 1;
b = 1;
MatchLocalNameQ[a, b]


a = 1;
b = 1;
MatchLocalNameQ[a, a]


But what want to do really this function?It's useful to us?

  • 2
    $\begingroup$ considering its name I'd expect it to check whether something is a local variable like in MatchLocalNameQ[Evaluate@Module[{a},a],a] which gives True. The second seems to be a "template" for which the local variable has been generated. $\endgroup$ Dec 18, 2016 at 16:51
  • 3
    $\begingroup$ I think it's closely connected to MatchLocalNames, which gives a bit of a hint. $\endgroup$
    – corey979
    Dec 18, 2016 at 16:56
  • $\begingroup$ @corey979 Thanks,that is a reasonable guess(ping QuantumDot,too) $\endgroup$
    – yode
    Dec 18, 2016 at 16:58

1 Answer 1


It checks whether the first argument is a Module-localized version of the second:

MatchLocalNameQ[x$1, x]
(* True *)

Module localizes like this:

Module[{x}, x]
(* x$29141 *)

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.