I encounter a situation demonstrated in the following piece of codes:



X := `<,>`(1, 2, 3);
T := proc () K[1] end proc;
S := proc (X) subs(K = uneval('X'), eval(T)) end proc;
S(X);
The output is:
[1]
[ ]
X := [2]
[ ]
[3]
T := proc() K[1] end proc
S := proc(X) subs(K = uneval('X'), eval(T)) end proc
proc() 'Vector(3, [...], datatype = anything)'[1] end proc
How can I prevent X from being evaluated into a Vector in the substitution in S?
I really expects to get
proc() 'X'[1] end proc
as output of S(X).
Thanks!
Note:
If I directly run
subs(K = uneval('X'), eval(T)) in maple document, I can get the expected result:

proc () 'X'[1] end proc
I really doubt if it is a bug.
A solution found!
<p>Thank you everyone anyway!</p>
<p>I eventually found a solution, to use convert("X",symbol) instead of uneval('X'). But it does not work in more complex case. Therefore, a solution is still expected.</p>
uneval quotes, evaln
I'm not really sure what you're trying to get.
> X := `<,>`(1, 2, 3): > T := proc () K[1] end proc: > S := proc (X::evaln) subs(K = ''X'', eval(T)) end proc: > g:=S(X); g := proc() 'X'[1] end proc > g(); X[1]What is the "more complex case", and what do you wish for it?
acer
Preventing evaluation
The real problem, I think, that you want your procedure S to be passed the name X rather than the value of X. Try this:
apparently
According to the original post, he apparently wants,
> S(X); proc() 'X'[1] end procPresumably, that really is what he is after.
That won't happen for the S above. But with a few uneval quotes like in subs(K=''Y'',eval(T)) it could. Then it might be a question of whether he'd rather define it as proc(Y::uneval)... or as proc(Y::evaln)...
acer
Thank you, but
I am not passing a name to S. X is a vector in practice, it is the value of X that is intended to be passed.
In fact, the procedure T acts as a template, so that K, in T, is to be replaced by what actually makes T work. But T has a variable X, which is of the same name as the one in S. In the process of building new procedure based on T, K need be replaced with an expression involving X. For example, K may be expected to become X.X or X+X.X. After that replacement, the new procedure is compiled and run.