Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Make a pair of lists consisting of alternate terms from the original list
ResourceFunction["BisectList"][{a1,a2,a3,a4,a5,a6,…}] makes the list {{a1,a3,a5…},{a2,a4,a6,…}}. |
The lists being riffled have the same length:
In[1]:= | ![]() |
Out[1]= | ![]() |
BisectList gives back the sublists:
In[2]:= | ![]() |
Out[2]= | ![]() |
Here, the riffled lists have different lengths:
In[3]:= | ![]() |
Out[3]= | ![]() |
BisectList ignores the last term:
In[4]:= | ![]() |
Out[4]= | ![]() |
Here the head of the expression is not List:
In[5]:= | ![]() |
Out[5]= | ![]() |
Add consecutive pairs of a list:
In[6]:= | ![]() |
Out[6]= | ![]() |
Apply BisectList twice:
In[7]:= | ![]() |
Out[7]= | ![]() |
Pull out the interleaved subsequences, making them both positive:
In[8]:= | ![]() |
Out[8]= | ![]() |
In[9]:= | ![]() |
Out[9]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License