Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate a list with values satisfying a given condition
ResourceFunction["ListBuilder"][expr,{i,imax},test] generates a list of the values of expr when i runs from 1 to imax satisfying the test condition. | |
ResourceFunction["ListBuilder"][expr,{i,imin,imax},test] starts with i=imin. | |
ResourceFunction["ListBuilder"][expr,{i,imin,imax,di},test] uses steps di. | |
ResourceFunction["ListBuilder"][expr,{i,{i1,i2,…}},test] uses the successive values i1,i2,…. | |
ResourceFunction["ListBuilder"][expr,{i,imin,imax},{j,jmin,jmax},…,test] uses multiple nested iterators. | |
ResourceFunction["ListBuilder"][expr,iter1,iter2,…] gives a flattened version of Table[expr,iter1,iter2,…]. |
A list of odd integers up-to 10:
| In[1]:= |
| Out[1]= |
A list of even squares from 0 to 100:
| In[2]:= |
| Out[2]= | ![]() |
A list of absolute values of even numbers between -100 and 100 divisible by 3:
| In[3]:= |
| Out[3]= |
Iterate over an explicit list of values:
| In[4]:= |
| Out[4]= |
A list with nested iterators and a condition:
| In[5]:= |
| Out[5]= |
ListBuilder with no test condition is equivalent to Flatten[Table[expr,…]] or ResourceFunction["FlatTable"][expr,…]:
| In[6]:= |
| Out[6]= |
| In[7]:= |
| Out[7]= |
| In[8]:= |
| Out[8]= |
Wolfram Language 14.0 (January 2024) or above
This work is licensed under a Creative Commons Attribution 4.0 International License