Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Apply a function to a list and select the first that satisfies a test
ResourceFunction["SelectFirstBy"][test,f,{e1,e2,…}] computes f[ei] until test gives True, or returns $Failed if none do. |
The first factorial value greater than 1,000:
In[1]:= | ![]() |
Out[1]= | ![]() |
If there are no elements satisfying a criterion, SelectFirstBy gives $Failed:
In[2]:= | ![]() |
Out[2]= | ![]() |
The first element that satisfies an approximation according to some criteria:
In[3]:= | ![]() |
Out[3]= | ![]() |
The first word consisting of 20 letters:
In[4]:= | ![]() |
Out[4]= | ![]() |
The first element with a melting point greater than 1,000 degrees:
In[5]:= | ![]() |
Out[5]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License