Given two functions, generates a function that returns