Add map() and flatmap()

As discussed in #11.
After switching to `reduce`, this didn't really apply anymore