5
$\begingroup$

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]

False

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

True

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

$\endgroup$
3
  • 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$ Commented 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
    Commented Dec 18, 2016 at 16:56
  • $\begingroup$ @corey979 Thanks,that is a reasonable guess(ping QuantumDot,too) $\endgroup$
    – yode
    Commented Dec 18, 2016 at 16:58

1 Answer 1

8
$\begingroup$

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 *)
$\endgroup$

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.