Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Evaluate code in a resource function definition notebook
ResourceFunction["EvaluateDefinitionNotebookSection"][] evaluates the definition section in the current InputNotebook[]. | |
ResourceFunction["EvaluateDefinitionNotebookSection"]["section"] evaluates the named section in the current InputNotebook[]. | |
ResourceFunction["EvaluateDefinitionNotebookSection"][nb] evaluates the definition section in the given notebook. | |
ResourceFunction["EvaluateDefinitionNotebookSection"][nb,"section"] evaluates the named section in the given notebook. |
Evaluate the definition section of a function resource notebook:
In[1]:= | ![]() |
Out[1]= | ![]() |
In[2]:= | ![]() |
Out[2]= | ![]() |
View the evaluated cells:
In[3]:= | ![]() |
Out[3]= | ![]() |
Verify that the function is defined:
In[4]:= | ![]() |
Out[4]= | ![]() |
In[5]:= | ![]() |
Retrieve a resource function definition notebook and evaluate the definitions:
In[6]:= | ![]() |
Out[6]= | ![]() |
The function is now defined:
In[7]:= | ![]() |
Out[7]= | ![]() |
Get a definition notebook:
In[8]:= | ![]() |
Out[8]= | ![]() |
Define the function by evaluating the "Definition" section:
In[9]:= | ![]() |
Out[9]= | ![]() |
Run the tests:
In[10]:= | ![]() |
Out[10]= | ![]() |
Run the examples:
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Evaluate the "Data Definitions" section of a data resource notebook:
In[13]:= | ![]() |
Out[13]= | ![]() |
In[14]:= | ![]() |
Out[14]= | ![]() |
View the evaluated section:
In[15]:= | ![]() |
Out[15]= | ![]() |
In[16]:= | ![]() |
EvaluateDefinitionNotebookSection can work on any notebook that has cell groups with CellTags set for the first cell in the group:
In[17]:= | ![]() |
Out[17]= | ![]() |
Evaluate the first section:
In[18]:= | ![]() |
Out[18]= | ![]() |
Evaluate the second section:
In[19]:= | ![]() |
Out[19]= | ![]() |
In[20]:= | ![]() |
If the section does not exist in the notebook, an error message will be printed:
In[21]:= | ![]() |
Out[21]= | ![]() |
In[22]:= | ![]() |
Out[22]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License