Jacques Gélinas on Mon, 25 Feb 2019 22:30:10 +0100


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

RE: Getting arity of closures


>It would seem to me that this should work:
> ? install("closure_arity","lG")

Nice solution, but does not work for some builtins.

vc = vector;
vc(1,k,k)
  ***   at top-level: vc(1,k,k)
  ***                 ^---------
  ***   too many parameters in user-defined function call.
closure_arity(vc) == 2

alias(v,vector)
v(1,k,k) == [1]
closure_arity(v) == 2

\\ This was discussed in
\\  http://pari.math.u-bordeaux.fr/archives/pari-users-1712/msg00029.html

\\ What is the meaning of
closure_arity(anything) == 4612530443357519872

Jacques Gélinas