Bill Allombert on Tue, 11 Feb 2003 21:52:32 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: gp: subst(x^2+x+1,x^2+1,x)


On Tue, Feb 11, 2003 at 12:04:53PM -0800, Ilya Zakharevich wrote:
> On Tue, Feb 11, 2003 at 07:05:21PM +0100, Bill Allombert wrote:
> > I believe we should come back to the plain subst(pol,'var,data)
> > and add another GP function for polynomial substitution, this
> > would be much saner than this.
> 
> Why?  Do you think that an error message would be more useful?

Yes, I do. I often make typos when using subst and I am glad gp catch them
right away instead of outputing garbage. For me it is a feature. 

Of course, it would be nice if gp output an error message along the line of

? subst(x^2+1,x^2+1,y)
  ***   variable name expected: subst(x^2+1,x^2+1,y)
                                            ^--------
  ***   Maybe you want to use substpol instead

so that people that *really* want to do fancy substitutions have an hint about substpol.

This is trivial with gp2c, but not with gp unfortunately, if we revert the prototype
to GnG (which is much saner than GGG).

I think we should reinstate the old (2.1) subst behaviour and add a substpol()
function that do what the current subst do.

Cheers,
Bill.