Perform a function on an interval