array reduce manually
array reduce via reduce