Is it possible to remove the "context" from the list of loaded Contexts []?

We can remove all characters in a specific context using Remove["context`*"] . But is it possible to remove the "context`" from the system so that it no longer appears in Contexts[] ?

+8
wolfram-mathematica
source share
1 answer

As far as I can tell (assumption), the context is automatically removed from Contexts[] when it becomes empty (has no characters). At least this happens in my tests. Here is one of them:

 In[1]:= BeginPackage["Test`"] EndPackage[] Out[1]= Test` In[3]:= MemberQ[Contexts[],"Test`"] Out[3]= False In[4]:= Test`a Out[4]= a In[5]:= MemberQ[Contexts[],"Test`"] Out[5]= True In[6]:= Remove["Test`*"] In[7]:= MemberQ[Contexts[],"Test`"] Out[7]= False 

It may also explain why the call to Contexts[] takes a significant fraction of a second - the system should check each context to see if it is empty. In any case, the answer to your question seems simple - delete all characters and the context will be removed from Contexts[] . This also works for contexts loaded by the system - you can try some ( XML' for example), although, of course, this is not a good practice, to say the least.

+6
source share

All Articles