Add reduce function to Collection

Also added a test for Collection::map()

Cleaner changeset of #2176 :)