SequenceFold
SequenceFold[f,{x1,…,xn},{a1,a2,…}]
gives the last element of SequenceFoldList[f,{x1,…,xn},{a1,a2,…}].
SequenceFold[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.
Details
- In SequenceFold[f,{x1,…,xn},{a1,a2,…}], the function f is assumed to have n+1 arguments.
- SequenceFold[f,{x},{a1,a2,…}] is equivalent to Fold[f,x,{a1,a2,…}].
- SequenceFold[f,{x1,…,xn},{a1,a2,…}] is equivalent to SequenceFold[f,{x1,…,xn},{a1,a2,…},n+1].
- In SequenceFold[f,{x1,…,xn},{a1,a2,…},k], the integer k must obey k≥n.
Examples
open allclose allScope (2)
Properties & Relations (5)
SequenceFold[f,xlist,alist] returns the last element of SequenceFoldList[f,xlist,alist]:
Starting with a seed sequence of length 1 makes SequenceFold equivalent to Fold:
An empty seed sequence makes SequenceFold apply the function to the last element of the final list:
If f has only one argument, then SequenceFold is equivalent to Nest:
The number of arguments of the function cannot be smaller than the length of the seed sequence:
If they are equal, then the actual elements of the list in the third argument are not used:
Text
Wolfram Research (2015), SequenceFold, Wolfram Language function, https://reference.wolfram.com/language/ref/SequenceFold.html.
CMS
Wolfram Language. 2015. "SequenceFold." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SequenceFold.html.
APA
Wolfram Language. (2015). SequenceFold. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SequenceFold.html