when side-effecting, use foreach rather than map