add apply() for statements

The idea here is to separate iteration from function, the same as was done for Expressions. I plan to refactor to use it after it is pulled.