Fix #5091, implement and document foldl and foldr

Plus a few typo fixes in the documentation for reduce.