Michael Somos on Mon, 25 Feb 2019 16:17:43 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Getting arity of closures
|
- To: Jeroen Demeyer <J.Demeyer@ugent.be>
- Subject: Re: Getting arity of closures
- From: Michael Somos <ms639@georgetown.edu>
- Date: Mon, 25 Feb 2019 10:17:39 -0500
- Cc: pari-users <pari-users@pari.math.u-bordeaux1.fr>
- Delivery-date: Mon, 25 Feb 2019 16:17:43 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=georgetown.edu; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5gDlIG7ZMUSse1uBwY7rign0sMM9hvvSAsOsbTTk2Bw=; b=dB0JxLBT7cpP3nwcil9o+ykEm+8myxdVOlZS0L63ui4rjdIgnKK8TMetSJ2zRneYm+ QO1NPbLmZC08W4HPypFO4W0niQFkWj9U7KI7HNjqHBuTQ6Bl1ujp3j+oSbYRNaCj6nm/ Lt0zBCxr1S/kJMUWUHs0BaAxn5N14CNryQzbU=
- In-reply-to: <5C73FFAF.8080504@UGent.be>
- References: <5C73FFAF.8080504@UGent.be>
The following code may do what you want:
arity(f)=my(v= Vec(component(f,5)[1])); #select(x->x==",",v)+(v!=[])
It is a bit clunky, but it works. Try arity(arity).
On 2/25/19, Jeroen Demeyer <J.Demeyer@ugent.be> 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).
>
>