Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Filter a list, keeping only increasing values
ResourceFunction["IncreasingFilter"][list] filters list by only selecting increasing values. | |
ResourceFunction["IncreasingFilter"][list,p] filters list using the ordering function p. |
Only retain the increasing values of a list:
| In[1]:= |
| Out[1]= |
Filter another list:
| In[2]:= |
| Out[2]= |
Use a different ordering function p:
| In[3]:= | ![]() |
| Out[3]= |
Apply it to strings using the ordering function AlphabeticOrder:
| In[4]:= |
| Out[4]= |
Filter with decreasing values:
| In[5]:= |
| Out[5]= |
Do not allow for repeated items making a strictly increasing sequence:
| In[6]:= |
| Out[6]= |
An empty list as input just returns an empty list:
| In[7]:= |
| Out[7]= |
A single element stays a single element:
| In[8]:= |
| Out[8]= |
IncreasingFilter is idempotent:
| In[9]:= | ![]() |
| Out[9]= |
The input and output do not necessarily have the same length:
| In[10]:= |
| Out[11]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License