Question: Execute expression when creating a function

How to execute expression when creating a function?
(before creating it, inside it)

> f:=(x1,x2,x3)->x1;
> f(1,2,3);
                       f := (x1, x2, x3) -> x1
> var:=seq(cat(x,k),k=1..3);
> g:=(var)->x1;
> g(1,2,3);
                          var := x1, x2, x3
                            g := var -> x1
> h:=(x1,x2,x3)->cat(x,1);
> h(1,2,3);
                    h := (x1, x2, x3) -> cat(x, 1)
> f(x3,x2,x1)-g(x3,x2,x1);
> f(x3,x2,x1)-h(x3,x2,x1);
> g(x3,x2,x1)-h(x3,x2,x1);
                               x3 - x1
                               x3 - x1

Why functions f, g, h aren't the same?

I need to create many functions in a loop and the number of arguments changes every time. So, using seq would be a really useful, but it doesn't work.
I've tried to use unapply, but the result is the same. Also tried eval and value.

Any suggestions?

One more problem (can't use x[k] when defining a function?):
> z:=(x[1],x[2],x[3])->x[1];
Error, symbol or symbol::type or symbol:=expression expected in parameter list

Please Wait...