Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create an operator that maps a function over data at a specified level
ResourceFunction["MapLevel"][f,levelspec][data] maps the function f over data at the level set forth in levelspec. |
Create a Map function that will apply a function f exclusively at parts of the expression lying at level 2:
In[1]:= |
Out[1]= |
Apply the function just created to an expression that is of depth 3:
In[2]:= |
Out[2]= |
MapLevel works with integer level specifications, just as Map does:
In[3]:= |
Out[3]= |
MapLevel works with Association, just as Map does:
In[4]:= |
Out[4]= |
MapLevel works at multiple levels of an association:
In[5]:= |
Out[5]= |
Of people over age 40 on the Titanic, find the survival numbers broken down by cabin class, using MapLevel as part of a pipeline of operators:
In[6]:= |
Out[6]= |
This work is licensed under a Creative Commons Attribution 4.0 International License