Why? What are you trying to achieve? It would help for readability if you used code tags. map returns a new list, whereas for allows modification of an existing one. You need to take the input list in your map and use that as the for list. You then need to push your result onto the output array. But if your code works, then why rewrite it to use for?