Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
A flattened version of Table
ResourceFunction["FlatTable"][expr,n] generates a list of n copies of expr. | |
ResourceFunction["FlatTable"][expr,n,m] gives a list of n×m copies of expr. | |
ResourceFunction["FlatTable"][expr,{i,…},{j,…},…] gives a list of the values of expr in which i is incremented last. | |
ResourceFunction["FlatTable"][args] gives a flattened version of Table[args]. |
A table of the first 5 squares:
In[1]:= | ![]() |
Out[1]= | ![]() |
A flattened version of a 4⨯3 matrix:
In[2]:= | ![]() |
Out[2]= | ![]() |
A flattened version of a triangular array:
In[3]:= | ![]() |
Out[3]= | ![]() |
Compare:
In[4]:= | ![]() |
Out[4]= | ![]() |
For non-list expr, FlatTable[expr,…] is equivalent to Flatten[Table[expr,…]]:
In[5]:= | ![]() |
Out[5]= | ![]() |
In[6]:= | ![]() |
Out[6]= | ![]() |
FlatTable preserves lists in expr:
In[7]:= | ![]() |
Out[7]= | ![]() |
Compare to Flatten[Table[expr,…]]:
In[8]:= | ![]() |
Out[8]= | ![]() |
For two-dimensional tables, FlatTable[expr,…] is equivalent to Catenate[Table[expr,…]]:
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License