Question: The End of Parameters Marker, $

A large procedure I made caused me some problems. I finally found the source of the problem.
There seems to be some interaction between the end of parameters marker, $, and the elementwise operation ~.

Consider these 3 versions of essentially the same procedure:

restart;
Q1:=proc(Var::list,$) local n;
  n:=nops(Var);
  print(Var,n);
  proc(var::list)
       subs(Var=~[seq(1..n)],var); #Elementwise
  end proc;
end proc:
Q1([x,y]); #Doesn't work : "invalid expression"
Q2:=proc(Var::list,$) local n;
  n:=nops(Var);
  print(Var,n);
  proc(var::list)
      subs(zip(`=`,Var,[seq(1..n)]),var); # zip
  end proc;
end proc:
Q2([x,y]); #No problem
Q3:=proc(Var::list) local n; #No end of parameters marker $
  n:=nops(Var);
  print(Var,n);
  proc(var::list)
       subs(Var=~[seq(1..n)],var); # Elementwise
  end proc;
end proc:
Q3([x,y]); # No problem
lprint(Q3([x,y])); #Curious output involving ` $`
#A fourth procedure in which the output is not a procedure works:
Q4:=proc(Var::list,$) local n;
  n:=nops(Var);
  print(Var,n);
  subs(Var=~[seq(1..n)],Var)
end proc:
Q4([x,y]);

Does anybody have any comments? Is it a bug?

Please Wait...