eliminate imperative loops
eliminate imperative loops