This chapter describes the GAP package Example. As its name suggests it is an example of how to create a GAP package. It has little functionality except for being a package.
See Sections 2.1, 2.2 and 2.3 for how to install, compile and load the Example package.
If you are interested in developing a GAP package, see Reference: Using and Developing GAP Packages.
If you are viewing this with on-line help, type:
gap> ?Example package
to see the functions provided by the Example package.
The following functions are available:
‣ ListDirectory( [dir] ) | ( function ) |
lists the files in directory dir (a string) or the current directory if called with no arguments.
‣ FindFile( directory_name, file_name ) | ( function ) |
searches for the file file_name in the directory tree rooted at directory_name and returns the absolute path names of all occurrences of this file as a list of strings.
‣ LoadedPackages( ) | ( function ) |
returns a list with the names of the packages that have been loaded so far. All this does is execute
gap> RecNames( GAPInfo.PackagesLoaded );
You might like to check out some of the other information in the GAPInfo record (see Reference: GAPInfo).
‣ Which( prg ) | ( function ) |
returns the path of the program executed if Exec(prg); is called, e.g.
gap> Which("date"); "/bin/date" gap> Exec("date"); Fri 28 Jan 2011 16:22:53 GMT
‣ WhereIsPkgProgram( prg ) | ( function ) |
returns a list of paths of programs with name prg in the current packages loaded. Try:
gap> WhereIsPkgProgram( "hello" );
‣ HelloWorld( ) | ( function ) |
executes the C program hello provided by the Example package.
‣ FruitCake | ( global variable ) |
is a record with the bits and pieces needed to make a boiled fruit cake. Its fields satisfy the criteria for Recipe (1.1-8).
‣ Recipe( cake ) | ( operation ) |
displays the recipe for cooking cake, where cake is a record satisfying certain criteria explained here: its recognised fields are name (a string giving the type of cake or cooked item), ovenTemp (a string), cookingTime (a string), ingredients (a list of strings each containing an _ which is used to line up the entries and is replaced by a blank), method (a list of steps, each of which is a string or list of strings), and notes (a list of strings). The global variable FruitCake (1.1-7) provides an example of such a string.
generated by GAPDoc2HTML