Function Repository Resource:

Perform a folding operation parsing multiple arguments

Contributed by: Sander Huisman
 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.

## Examples

### Basic Examples (1)

Fold a function over lists, threading the elements:

 In[1]:=
 Out[1]=

### Scope (2)

Without an initializer, the first elements of list is the initializer:

 In[2]:=
 Out[2]=

Make an operator:

 In[3]:=

Use the operator, feeding in a list of lists:

 In[4]:=
 Out[4]=

### Applications (2)

Integrate the function f(x,y,z)=x+y+z as x ranges from 0 to 2, y from 0 to 2, and z from 0 to 2:

 In[5]:=
 Out[5]=

Create a continued fraction with different numerators:

 In[6]:=
 Out[6]=

### Properties and Relations (1)

FoldList and FoldThreadList are related for the case a single argument is folded in:

 In[7]:=
 Out[7]=

SHuisman

## Version History

• 1.0.0 – 25 November 2019