Question: How to use funсtion as a parameter of procedure?

I need to use a procedure where one of the parameters is a function. Conceptually, this seems straightforward, but I’m encountering unexpected behavior. Here’s a minimal example of my approach:

f1:=proc(t::numeric, fn::function)::numeric;
return fn(t+1)+1
end proc;

However, none of the following calls return the correct result:

f1(2, sin);
f1(2, sin());
f1(2, sin(x));
f1(2, u-> u^2);

Any guidance would be greatly appreciated!

Please Wait...