Bill Allombert on Fri, 29 Dec 2017 22:14:14 +0100


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

Re: Arity transfer from built-in function ?


On Fri, Dec 29, 2017 at 08:54:55PM +0000, Jacques Gélinas wrote:
> The arity transfer problem can be solved very simply by using "alias" instead of an assignment.
> 
> alias(vc,vector) 
> vc(3,k,k) == [1,2,3]
> 
> This works both in 2.4.1 (2007-03-28) and in 2.9.3 (2017-07-04).

This is true, but this is quite different from vc = vector:
Only GP code read after alias() is evaluated is affected:

? f(n)=vc(n,i,i);
? alias(vc,vector)
? f(6)
  ***   incorrect type in evaluator [variable name expected] (t_STR).
? f(n)=vc(n,i,i);
? f(6)
%4 = [1,2,3,4,5,6]

Cheers,
Bill.