higher order functions for iterating over files