Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Return a list of strings for all symbols in the given context that have values associated with them
ResourceFunction["DefinedSymbols"][] returns a list of strings for all symbols in the current context that have values associated with them. | |
ResourceFunction["DefinedSymbols"][context] returns a list of strings for all symbols in context that have values associated with them. |
Clear all global symbols:
In[1]:= | ![]() |
Set a function to place its head in the global context:
In[2]:= | ![]() |
Check that it is now a global symbol:
In[3]:= | ![]() |
Out[3]= | ![]() |
Clear all global symbols:
In[4]:= | ![]() |
DefinedSymbols checks for symbols in the global context with any OwnValues, DownValues or UpValues:
In[5]:= | ![]() |
Out[5]= | ![]() |
Clear all global symbols:
In[6]:= | ![]() |
Find a symbol with UpValues:
In[7]:= | ![]() |
Out[7]= | ![]() |
DefinedSymbols is more nuanced than simply calling Names to get all symbols in a context:
In[8]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[11]= | ![]() |
Remove all global symbols:
In[12]:= | ![]() |
DefinedSymbols is more subtle than Names:
In[13]:= | ![]() |
Out[13]= | ![]() |
In[14]:= | ![]() |
Out[14]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License