reduce behavior matches Array#reduce