Add flatten-map fn and test