> < ^ Date: Sat, 15 Apr 1995 18:44:00 +0100 (WET)
> < ^ From: Martin Schoenert <martin.schoenert@math.rwth-aachen.de >
< ^ Subject: Re: names I have used
Peter F. Blanchard wrote in his e-mail message of 1995/04/12

Unless I know there will be a lengthy calculation involved,
I tend to use Gap interactively. It happens that I define a number of
groups, elements, maps, etc with my own names. My question is whether
there is a method of recalling the names I have used.

This is not possible in GAP 3.4. But you can easily add this feature
(or you can wait for GAP 3.4.2, which is in internal testing currently).
Add the following function to 'idents.c'.

/****************************************************************************
**
*F  FunIdents(<hdCall>) . . . . . . . . . . . . .  list of global identifiers
*/
#include        "integer.h"

TypHandle       FunIdents ( hdCall )
    TypHandle           hdCall;
{
    TypHandle           hdList;
    TypHandle           hdName;
    unsigned long       i, k;
hdList = NewBag( T_LIST, SIZE(HdIdenttab)+SIZE_HD );
k = 0;
for ( i = 0; i < SIZE(HdIdenttab)/SIZE_HD; i++ ) {
    if ( PTR(HdIdenttab)[i] != 0 ) {
        hdName = NewBag( T_STRING, SIZE(PTR(HdIdenttab)[i])-SIZE_HD );
        SyStrncat( (char*)PTR(hdName),
                   (char*)(PTR( PTR(HdIdenttab)[i] )+1),
                   SyStrlen( (char*)(PTR( PTR(HdIdenttab)[i] )+1) ) );
        k = k + 1;
        PTR(hdList)[k] = hdName;
    }
}
PTR(hdList)[0] = INT_TO_HD( k );
    return hdList;
}

Then add the following line to the end of 'InitIdents'.

InstIntFunc( "Idents", FunIdents );

Finally add the followinf two lines to your '.gaprc' file.

IDENTS := Set( Idents() );
MyIdents := function () return Difference( Set(Idents()), IDENTS ); end;

And, volia, 'MyIdents();' will give a list of the global identifiers
introduced since '.gaprc' was read. Since '.gaprc' is read after the
library is initialized, 'MyIdents();' will not print the library
identifiers.

Hope this helps,

Martin.

-- .- .-. - .. -.  .-.. --- ...- . ...  .- -. -. .. -.- .-
Martin Sch"onert,   Martin.Schoenert@Math.RWTH-Aachen.DE,   +49 241 804551
Lehrstuhl D f"ur Mathematik, Templergraben 64, RWTH, 52056 Aachen, Germany

> < [top]