5.1 Information about a function

  • NameFunction( func ) F

    returns the name of a function. For operations, this is the name used in their declaration. For functions, this is the variable name they were first assigned to. (For some internal functions, this might be a name different from the name that is documented.) If no such name exists, "unknown" is returned.

    gap> NameFunction(SylowSubgroup);
    "SylowSubgroup"
    gap> Blubberflutsch:=x->x;;
    gap> NameFunction(Blubberflutsch);
    "Blubberflutsch"
    gap> a:=Blubberflutsch;;
    gap> NameFunction(a);             
    "Blubberflutsch"
    gap> NameFunction(x->x);
    "unknown"
    gap> NameFunction(NameFunction);
    "NAME_FUNC"
    

  • NumberArgumentsFunction( func ) F

    returns the number of arguments the function func accepts. For functions that use arg to take a variable number of arguments, as well as for operations, -1 is returned. For attributes, 1 is returned.

    gap> NumberArgumentsFunction(function(a,b,c,d,e,f,g,h,i,j,k)return 1;end); 
    11
    gap> NumberArgumentsFunction(Size);                   
    1
    gap> NumberArgumentsFunction(IsCollsCollsElms);
    3
    gap> NumberArgumentsFunction(Sum);               
    -1
    

    [Top] [Up] [Next] [Index]

    GAP 4 manual
    February 2000