Refactoring of folding functions: `foldl`, `foldr`, `mapfoldl`, and `mapfoldr`
Merge branch 'master' into dh/reduce3
test mapfoldl and mapfoldr + a bug fix to mapfoldr
move mapreduce functions above
generalize mapreduce (still need some tweaking ...)
fix a bug of mapreduce
reduce implemented based on new mapreduce
sum functions implemented based on new mapreduce
prod functions implemented based on new mapreduce
maximum/minimum functions implemented based on new mapreduce
move and/all codes above
reorganize tests for reduce
and, or, count reimplemented using new paradigm
tweak extrema
a small fix of mapreduce function signature
small fix to extrema, now it correctly handles [NaN, ....]
Merge pull request #7061 from JuliaLang/dh/reduce3

Further refactoring of reduce/mapreduce functions