0
$\begingroup$

I have some function in string format,and I can get it short name without context

First[Defer /@ ToExpression[#, InputForm, 
  HoldComplete]] & /@ {"GeneralUtilities`AllSameBy","GeneralUtilities`Buzz"}

{AllSameBy,Buzz}

But actually {GeneralUtilities`AllSameBy,GeneralUtilities`Buzz}(it is not a string form but a symbol form) is expected.How to implement this?

$\endgroup$
5
  • $\begingroup$ GeneralUtilities`QualifiedSymbolName is HoldAllComplete, and only works with Symbol arguments. Use ToExpression[#, InputForm, GeneralUtilities`QualifiedSymbolName]& /@ {"GeneralUtilities`AllSameBy", "GeneralUtilities`Buzz"} instead. $\endgroup$
    – Carl Woll
    Mar 15, 2017 at 23:42
  • $\begingroup$ It gives you the same thing that {GeneralUtilities`QualifiedSymbolName[AllSameBy], GeneralUtilities`QualifiedSymbolName[Buzz]} does, which you said is what you want. $\endgroup$
    – Carl Woll
    Mar 15, 2017 at 23:57
  • $\begingroup$ @CarlWoll I'm sorry,I have not noted that before.I have updated that $\endgroup$
    – yode
    Mar 16, 2017 at 0:03
  • $\begingroup$ If "GeneralUtilities`" is on the context path, then the context will not be displayed. If it is not on the context path, then the context will be displayed. What is the reason that you want to see the context? $\endgroup$
    – Carl Woll
    Mar 16, 2017 at 0:09
  • $\begingroup$ @CarlWoll I have known what you have said,you mean If we $ContextPath=DeleteCases[$ContextPath,"GeneralUtilities`"].Then the context will show.Well,I have to say I really don't know this knowledge.And do you mind I compose that as an answer? $\endgroup$
    – yode
    Mar 16, 2017 at 0:17

0

Browse other questions tagged or ask your own question.