Bill Allombert on Thu, 12 Nov 2015 14:14:24 +0100


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

Re: Vector of args


On Wed, Nov 11, 2015 at 09:18:22AM +0100, Loïc Grenié wrote:
> If you replace a fixed arg GP function with a variadic GP function, lots of
> > things will stop working, not just call(). Variadic GP functions were not
> > meant
> > to write replacement for fixed arg user functions, but to write
> > replacements for
> > built-in variadic functions, like printf.
> >
> 
>      Ok. However the use case is not completely useless: think of writing f
> with
>   a constant c and then decide to upgrade it to arbitrary polynomials with
>   coefficients in c[]. 

You do not need to use a variadic function for that! Just allow c to be 
a vector or a polynomial.

> If you call(f,...) or, worse, if someone else uses
> call(f,...)
>   the upgrade of f makes the "call" break.

As I say, there are lots of thing that will break beside call(), so this is not
a concern.

> f)? In that case
>   call(g,concat([a,b],c)) would also work with the version we propose.
> Inside the
>   variadic you know it is variadic, outside you may or may not know.

That would be both awkward and inefficient, since GP will need to undo the
concat operation.

Cheers,
Bill.