Function Repository Resource:

# EveryOther

Split a list into two sublists, gathering every other element of the list

Contributed by: Wolfram Staff
 ResourceFunction["EveryOther"][{e1,e2,e3,e4,…}] returns {{e1,e3,…},{e2,e4,…}}. ResourceFunction["EveryOther"][{e1,e2,…},n] returns n sublists {{e1,e1+n,…},…{en,e2n,…}}.

## Details and Options

For a list of even length, ResourceFunction["EveryOther"][list] is equivalent to Transpose[Partition[list,2]].
If n evenly divides the list length, ResourceFunction["EveryOther"][list,n] is equivalent to Transpose[Partition[list,n]].

## Examples

### Basic Examples (2)

Split the List, combining elements in odd and even positions:

 In[1]:=
 Out[1]=

Group elements separated by gaps of length n:

 In[2]:=
 Out[2]=

### Properties and Relations (2)

Transpose[Partition[list,2]] gives the same result as EveryOther[list], as long as list has an even number of elements:

 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=
 In[5]:=
 Out[5]=

Transpose[Partition[list,n]] gives the same result as EveryOther[list,n], as long n evenly divides Length[list]:

 In[6]:=
 Out[6]=
 In[7]:=
 Out[7]=
 In[8]:=
 Out[8]=

## Version History

• 1.0.0 – 31 August 2020