deg can be called with an intvec as a second argument:
http://www.singular.uni-kl.de/Manual/latest/sing_225.htm#SEC265Thus one can easily build a suitable command, e.g:
Code:
> proc vardeg(poly f, int n) { return(deg(f,leadexp(var(n)))); }
> ring rdp =0,(x,y),dp;
> poly f = x2+y3+x4y2+x5 +x2y;
> deg(f);
6
> vardeg(f,2);
3
> vardeg(f,1);
5
> // the proc makes an implicit check of the second argument for the variable number:
> vardeg(f,3);
? var number 3 out of range 1..2
? error occurred in or before ::vardeg line 1: ` return(deg(f,leadexp(var(n)))); `
? leaving ::vardeg
skipping text from `;` error at token `)`