Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Use rules as local variable lists
ResourceFunction["LocalizedByRules"][rules,expr] use rules as local variable lists in expr. |
Use rules as local variable lists:
In[1]:= | ![]() |
Out[1]= | ![]() |
Give a single rule for a localized variable:
In[2]:= | ![]() |
Out[2]= | ![]() |
Apply each rule separately:
In[3]:= | ![]() |
Out[3]= | ![]() |
Localize using different Wolfram Language scoping mechanisms:
In[4]:= | ![]() |
Out[4]= | ![]() |
Check this using explicit scoping:
In[5]:= | ![]() |
Out[5]= | ![]() |
An easy way to apply the solutions of an equation to TemplateExpression:
In[6]:= | ![]() |
Out[5]= | ![]() |
Variables with assigned values cannot be used in rules:
In[7]:= | ![]() |
Out[5]= | ![]() |
One can use HoldPattern to keep the left-hand side unevaluated:
In[8]:= | ![]() |
Out[8]= | ![]() |
The left hand side of each rule must be a symbol:
In[9]:= | ![]() |
Out[9]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License