Reduce function that merges each element of the list into a single object, using extend