Bill Allombert on Sun, 24 Dec 2017 22:46:30 +0100


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

Re: Arity transfer from built-in function ?


On Fri, Dec 22, 2017 at 04:27:48PM +0000, Jacques Gélinas wrote:
> What is the t_CLOSURE assignment problem here ?
> 
> # vc=vector;
> # vc(4,k,k)
>   ***   at top-level: vc(4,k,k)
>   ***                 ^---------
>   ***   too many parameters in user-defined function call.

The first k is not a function parameter! So the arity is 2!
When you do 'vector', you are converting a builtin function to a
user function. Unfortunately user functions and builtin functions
have different calling convention. The GP compiler generates code
to convert between them when possible. Unfortunately some calling
conventions are unavailable in GP. This is the case here.

So the only thing that is supported is
vc(n)

Cheers,
Bill.