Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

FoldPair

FoldPair[f,y0,list]
gives the last element of FoldPairList[f,y0,list].

FoldPair[f,y0,list,g]
gives the last element of FoldPairList[f,y0,list,g].

FoldPair[f,{a0,a1,a2,}]
is equivalent to FoldPair[f,a0,{a1,a2,}].

DetailsDetails

  • The function f in FoldPair[f,y0,list] always takes two arguments and is expected to return a pair {x,y} of expressions.
  • The expression expr in FoldPair[f,y0,expr] can be any nonatomic expression, with any head.
  • You can use Throw to exit from FoldPair before it is finished.
Introduced in 2015
(10.2)