Bill Allombert on Mon, 08 Feb 2016 18:12:05 +0100

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

Re: addhelp

On Sun, Feb 07, 2016 at 06:31:06PM +0100, Josef Eschgfaeller wrote:
> Is it possible to obtain the value of ?f as a string?
> For example I would like to get the (implicit) arity
> of a function as in the following example:
> --------------------------------------------------
> f (v) = {my ([x,y]=v); x+y}
> addhelp(f,2)
> ...
> s=helpstring(f) \\ Does such a function exist?

No, but you can do:
? Str(f)
%3 = "(v)->my([x,y]=v);x+y"

Maybe I should add a function to get the arity of a closure.

One dirty way to do it in GP is:
but this only work for user function.