map with INVOKE protocol
Add flatten algorithm