Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Similar to MapAt but with improved behavior for nested expressions involving associations
ResourceFunction["AssociationMapAt"][f,assoc,atSpec] applies f to the association assoc at the position(s) specified by atSpec. |
Apply a function to parts of a nested association:
In[1]:= |
Out[2]= |
Apply a function to “ragged” parts of a nested association:
In[3]:= |
Out[3]= |
Apply a function to a part that doesn’t exist:
In[4]:= |
Out[4]= |
The second argument of AssociationMapAt need not strictly be a nested association:
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
Contrast the behavior of MapAt and AssociationMapAt:
In[7]:= |
Out[7]= |
In[8]:= |
Out[8]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License