Function Repository Resource:

# FlatTable

A flattened version of Table

Contributed by: Wolfram Staff
 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].

## Details

In ResourceFunction["FlatTable"][args], args are the same as in Table[args].
ResourceFunction["FlatTable"][args], is effectively equivalent to Flatten[Table[args],Length[{args}]-2].
ResourceFunction["FlatTable"] has the attribute HoldAll, similar to Table.

## Examples

### Basic Examples (3)

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]=

### Properties and Relations (3)

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]=

## Version History

• 1.0.0 – 18 January 2021