Applies function to this program and returns the results. The result is cached, so future calls with the same function do not evaluate function.