Improved foldl implementation, which now adopts the type stable procedure and is specialized on common operations.
improve type stability of foldr
Merge pull request #6998 from lindahua/dh/reorg1

Improved foldl and foldr