Previous Up Next

6.40.30  Folding operators: foldl foldr

The foldl (left-fold) and foldr (right-fold) commands take an infixed operator or function of two variables and apply them across a sequence of inputs through left and right association.


Example.
Input:

foldl(’^’,2,3,5)

Output:

32768

which is 2(35)



Example.
Input:

foldr(’^’,2,3,5)

Output:

847288609443

which is 3(52)


Previous Up Next