SequenceFoldList

SequenceFoldList[f,{x1,,xn},{a1,a2,}]
gives {x1,,xn,f[x1,,xn,a1],f[x2,,xn,f[x1,,xn,a1],a2],}.

SequenceFoldList[f,{x1,,xn},{a1,a2,},k]
applies f to k arguments at each step, with the first n coming from the xi or previous results, and the last k-n coming from the ai.

DetailsDetails

  • In SequenceFoldList[f,{x1,,xn},{a1,a2,}], the function f is assumed to take n+1 arguments.
  • If xlist and alist are lists of length n and m respectively, then SequenceFoldList[f,xlist,alist] returns a list of length n+m. Any or both of n and m can be zero.
  • SequenceFoldList[f,{x},{a,b,}] is equivalent to FoldList[f,x,{a,b,}].
  • SequenceFoldList[f,{x1,,xn},{a1,a2,}] is equivalent to SequenceFoldList[f,{x1,,xn},{a1,a2,},n+1].
  • If xlist and alist are lists of length n and m respectively, then SequenceFoldList[f,xlist,alist,k] returns a list of length Max[2n+m-k+1,n]. Any of n, m, k can be zero, as long as kn.
Introduced in 2015
(10.2)