Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Retrieve the default values from a template
ResourceFunction["TemplateDefaults"][template] extracts the default values for the TemplateSlot slots in template. | |
ResourceFunction["TemplateDefaults"][template,form] gives values as specified by form. |
Automatic | automatically choose a format |
f | use merging function f for each slot |
Retrieve default values for a template:
In[1]:= |
Out[1]= |
Use a template with named slots:
In[2]:= |
Out[2]= |
Get the defaults for a prompt from the Prompt Repository:
In[3]:= |
Out[3]= |
Use a function prompt:
In[4]:= |
Out[4]= |
A string template has no defaults:
In[5]:= |
Out[5]= |
Repeated slots in the template are repeated in the output:
In[6]:= |
Out[6]= |
Specify a custom merging function:
In[7]:= |
Out[7]= |
The order of the indexed values is determined by the slot numbers:
In[8]:= |
Out[8]= |
Positions with no slots in the template give Inherited:
In[9]:= |
Out[9]= |
When all defaults for a slot are deferred by RuleDelayed, the merging function does not evaluate:
In[10]:= |
Out[10]= |
Wolfram Language 14.0 (January 2024) or above
This work is licensed under a Creative Commons Attribution 4.0 International License