Bill Allombert on Mon, 22 Feb 2010 21:22:23 +0100

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

Re: Getting the variable number of a lexical local variable

On Mon, Feb 22, 2010 at 01:11:10PM -0500, Charles Greathouse wrote:
> > The prototype code V is for functions that use the code E or I.
> > Such local variables are not formal variables and does not have a
> > formal variable number (but they have a lexical variable number).
> I guess what I was trying to find was the lexical variable number,
> then.  I do want to use a V prototype code so that a user (in GP) can
> type
> sumformal(y=1, n, x*y^3 + y)
> and I can pull the relevant variable out of the polynomial.

If you use V, then you have to use the code E, and then you lose access
to the polynomial. Instead you get a function that gives the values of
the polynomial.  So unfortunately, you have to use the code n instead.

For example:
sumformal('y,1, n, x*y^3 + y)
sumformal(1, n, x*y^3 + y, 'y)