Bill Allombert on Mon, 04 Mar 2019 23:26:45 +0100


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

Re: Getting arity of closures


On Mon, Feb 25, 2019 at 03:46:07PM +0100, Jeroen Demeyer wrote:
> Is there any GP function to determine the arity of a closure? Something like
> that would be useful, for example to specify different behaviour when taking
> a closure as input (like lfuncreate for example).

Hello Jeroen,

I added a GP function arity for that purpose.
Please test.

? f1(x,y=0)=x+y;
? arity(f1)
%1 = 2

Cheers,
Bill.