[GAP Forum] function search feature

kroeker kroeker at uni-math.gwdg.de
Fri Feb 24 23:02:46 GMT 2012


Hello Frank,


thanks, "AllOperations" comes already very close to my needs.
Maybe you could also give me an advice, how to find
all filters which are applicable to an object:

"IsEmpty" is not applicable to an int and therefore
"obj:=5; for each filter in FILTERS do filter(obj); od;"
fails with an error.


Thank you,



Jakob


Am 23.02.2012 23:07, schrieb Frank Lübeck:
> On Thu, Feb 23, 2012 at 08:11:20PM +0000, Alexander Konovalov wrote:
>> I've noticed that this question was not answered yet in the Forum:
>>
>> On 9 Jan 2012, at 09:59, kroeker wrote:
>>
>>> Hello,
>>>
>>> sometimes I am looking for a function which is applicable to a specific object
>>> without knowing the name of the function. To find the desired function
>>> I have to read a lot of documentation, look for examples, ask an experienced GAP programmer (or the GAP-Forum) and so on.
>>>
>>> Would it be possible to implement a search through all existing functions
>>> where one of the parameters is an object of a specified type?
>> So, the short answer is 'No' - GAP function may take any argument(s), one does not
>> specify to which arguments it applies when the function is created. GAP also
>> has a notion of 'operation' which is a bunch of functions, called 'methods'
>> - these are installed with particular requirements on their arguments. Here
>> you may call ApplicableMethod (see ?ApplicableMethod) to get the function
>> which will be applied to arguments in a call to a specified operation - but
>> this is not what you want, since you need to know the name of the operation
>> in advance. For example,
> Dear Jakob, dear Forum,
>
> Sorry, I must have overlooked the original post.
>
> This reminds me that I have once written a utility function
>     AllOperations(obj)
> which returns a list of 6 lists of names of operations such that
> the operations from the i-th list have a method that allows obj as
> argument number i.
>
> I think (a variant of) this is used for a completion function in the
> Sage interface to GAP. The function is appended below.
>
> As Alexander pointed out, something like that is only possible for
> operations (whose methods are installed with requirements on the arguments)
> and not for general functions in GAP.
>
> With best regards,
>    Frank
>




More information about the Forum mailing list