WLJS LogoWLJS Notebook

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.

Examples

SequenceFold[Plus, {0, 1}, {2, 3, 4, 5}]
SequenceFold[Times, {1, 2}, Range[3, 6]]

Please visit the official Wolfram Language Reference for more details.

On this page