You have to "remove the brackets" of your list, so that the input of function is not a single list of four symbols, but four symbols (note the star before vars):
sage: f=function('f')(*vars)