Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Perform a folding operation parsing multiple arguments
ResourceFunction["FoldThreadList"][f,x ,{{a1,a2,…},{b1,b2,…},…}] gives {x, f[x,a1,b1,…], f[f[x,a1,b2,…], a2,b1, …], …}. |
|
ResourceFunction["FoldThreadList"][f,{{a1,a2,…},{b1,b2,…},…}] gives {{a1,b1,…},f[{a1,b1,…},a2,b2,…],f[f[{a1,b1,…},a2,b2,…],a3,b3,…],…}. |
|
ResourceFunction["FoldThreadList"][f] represents an operator form of ResourceFunction["FoldThreadList"] that can be applied to expressions. |
Fold a function over lists, threading the elements:
In[1]:= |
![]() |
Out[1]= |
![]() |
Without an initializer, the first elements of list is the initializer:
In[2]:= |
![]() |
Out[2]= |
![]() |
Make an operator:
In[3]:= |
![]() |
Feed a list of lists:
In[4]:= |
![]() |
Out[4]= |
![]() |
First integrate x from 0 to 2, then y from 0 to 2, then z from 0 to 2:
In[5]:= |
![]() |
Out[5]= |
![]() |
Create a continued fraction with different numerators:
In[6]:= |
![]() |
Out[6]= |
![]() |
FoldList and FoldThreadList are related for the case in which a single argument is folded in:
In[7]:= |
![]() |
Out[7]= |
![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License