Goto Chapter: Top 1 2 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

1 The Example Package
 1.1 The Main Functions

1 The Example Package

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.

1.1 The Main Functions

The following functions are available:

1.1-1 ListDirectory
‣ ListDirectory( [dir] )( function )

lists the files in directory dir (a string) or the current directory if called with no arguments.

1.1-2 FindFile
‣ 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.

1.1-3 LoadedPackages
‣ 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).

1.1-4 Which
‣ Which( prg )( function )

returns the path of the program executed if Exec(prg); is called, e.g.

gap> Which("date");         
gap> Exec("date");
Fri 28 Jan 2011 16:22:53 GMT

1.1-5 WhereIsPkgProgram
‣ WhereIsPkgProgram( prg )( function )

returns a list of paths of programs with name prg in the current packages loaded. Try:

gap> WhereIsPkgProgram( "hello" );

1.1-6 HelloWorld
‣ HelloWorld( )( function )

executes the C program hello provided by the Example package.

1.1-7 FruitCake
‣ 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).

1.1-8 Recipe
‣ 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.

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 Ind

generated by GAPDoc2HTML