Are functions with general arguments possible?

Is there a way to write a function equivalent to

f(a, b) = ax + by

where a, b are local variables to the function and x, y, the built in current-point variables?

Thus f(3, 5) would return 3x + 5y, with x, y having whatever their currents values are.

func real f(real a, real b) {
    return a * x + b * y;
mesh Th = square(10, 10);
fespace Vh(Th, P1);
Vh u = f(3, 5);
1 Like