[GAP Forum] function search feature

Frank Lübeck frank.luebeck at math.rwth-aachen.de
Sat Feb 25 12:56:59 GMT 2012


On Sat, Feb 25, 2012 at 12:02:46AM +0100, kroeker wrote:
> 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

Dear Jakob, dear Forum,

You need to divide FILTERS in two subsets. (There are some filters, e.g.
created by NewCategory,  which don't occur in OPERATIONS because no methods
should be installed for them.)

f1 := Filtered(FILTERS, f-> f in OPERATIONS);;
f2 := Filtered(FILTERS, f-> not f in OPERATIONS);;
obj:=5;; for filter in f2 do filter(obj); od;

So, the filters in f2 are always applicable, those in f1 can be handled
by the code from AllOperations for one argument methods.

BTW: f1 contains many Tester filters, the restriction to "documented
operations" in AllOperations avoids that almost all of them occur in
the result of AllOperations for most objects.

Hope this helps,
  Frank

-- 
///  Dr. Frank Lübeck, Lehrstuhl D für Mathematik, Templergraben 64,  ///
\\\                    52062 Aachen, Germany                          \\\
///  E-mail: Frank.Luebeck at Math.RWTH-Aachen.De                        ///
\\\  WWW:    http://www.math.rwth-aachen.de/~Frank.Luebeck/           \\\




More information about the Forum mailing list