Question: Use output for function definition

I want the output from a line to be used for the definition of a function, but it doesn't work. What am I missing?

x^2;
f := X -> eval(%, x=X);
f(t);

Thank you, Ale

Please Wait...