fix type of reduce()
Merge branch 'master' into gfx/optimize-tail-recursion