Bill Allombert on Tue, 26 Nov 2013 21:40:44 +0100


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

Re: Accessing member functions by name in libpari


On Tue, Nov 26, 2013 at 12:26:43PM +0100, Jeroen Demeyer wrote:
> Hello pari-dev,
> 
> It is possible in libpari to access a GP member function by name?

Do you mean a GP defined member function or a built-in member function ?

> For example, I want something that given a GEN nf (representing a
> number field) and the string "zk" gives me the GEN nk.zk.

_.zk is a built-in member function. In libpari it is called member_zk (for nf,
you can use nf_get_zk()) instead.  

the following (untested) function should do what you want:

GEN fun(const char *s, GEN nf)
{
  return closure_callgen1(strtofunction(gsprintf("_.%s", s)), nf);
}

Cheers,
Bill.