Replace map+inject with inject

Use ``inject`` alone instead of ``map`` then ``inject`` to avoid creating an extra array.