%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %W example.tex GAP documentation Werner Nickel %W Greg Gamble %% %H $Id: example.tex,v 4.5 2006/01/31 11:18:12 gap Exp $ %% %Y Copyright (C) 1997, School of Math & Comp. Sci., St Andrews, Scotland %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \Chapter{The Example Package} \atindex{Example package}{@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~"Installing the Example Package" and~"Loading the Example Package" for how to install and load the {\Example} package, or Appendix~"Hints for writing a GAP Package" for hints on how to write a {\GAP} package. If you are viewing this with on-line help, type: \beginexample gap> ?> \endexample to see the functions provided by the {\Example} package. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \Section{The main functions} The following functions are available: \>ListDirectory([<dir>]) F lists the files in directory <dir> (a string) or the current directory if called with no arguments. \>FindFile( <directory_name>, <file_name> ) F 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() F returns a list with the names of the packages that have been loaded so far. All this does is execute \beginexample gap> RecNames( GAPInfo.PackagesLoaded ); \endexample You might like to check out some of the other information in the `GAPInfo' record. \>Which( <prg> ) F returns the path of the program executed if `Exec(<prg>);' is called, e.g. \beginexample|unstableoutput gap> Which("date"); "/bin/date" gap> Exec("date"); Sun Oct 7 16:23:45 CEST 2001 \endexample \>WhereIsPkgProgram( <prg> ) F returns a list of paths of programs with name <prg> in the current packages loaded. Try: \beginexample gap> WhereIsPkgProgram( "hello" ); \endexample \>HelloWorld() F executes the C program `hello' provided by the {\Example} package. \>`FruitCake' V is a record with the bits and pieces needed to make a boiled fruit cake. Its fields satisfy the criteria for `Recipe' (see~"Recipe"); \>Recipe( <cake> ) M displays the recipe for cooking <cake>, where <cake> is a record. The fields of <cake> recognised 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). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %E Emacs . . . . . . . . . . . . . . . . . . . . . local emacs variables %% %% Local Variables: %% fill-column: 73 %% End: %%