Document foldl and foldr implementation

backport of 7c8bf1304458004a9e37cb2eba2cf507aa0fcdea

Document mapreduce and friends

Update documentation for reduce, foldl, and foldr.
Add mapreduce documentation for variant with v0.
Add mapfoldl, mapfoldr documentation.

backport of 2c6707426cf2ccd8985d3c0b516afc452d3e956d