curried the implementation of mapcatting