Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 4183461[1X1 [33X[0;0YThe Example Package[133X[101X23[33X[0;0YThis chapter describes the [5XGAP[105X package [5XExample[105X. As its name suggests it is4an example of how to create a [5XGAP[105X package. It has little functionality5except for being a package.[133X67[33X[0;0YSee Sections [14X2.1[114X, [14X2.2[114X and [14X2.3[114X for how to install, compile and load the8[5XExample[105X package, or Appendix [14XA[114X for guidelines on how to write a [5XGAP[105X package.[133X910[33X[0;0YIf you are viewing this with on-line help, type:[133X1112[4X[32X Example [32X[104X13[4X[25Xgap>[125X [27X?Example package[127X[104X14[4X[32X[104X1516[33X[0;0Yto see the functions provided by the [5XExample[105X package.[133X171819[1X1.1 [33X[0;0YThe Main Functions[133X[101X2021[33X[0;0YThe following functions are available:[133X2223[1X1.1-1 ListDirectory[101X2425[29X[2XListDirectory[102X( [[3Xdir[103X] ) [32X function2627[33X[0;0Ylists the files in directory [3Xdir[103X (a string) or the current directory if28called with no arguments.[133X2930[1X1.1-2 FindFile[101X3132[29X[2XFindFile[102X( [3Xdirectory_name[103X, [3Xfile_name[103X ) [32X function3334[33X[0;0Ysearches for the file [3Xfile_name[103X in the directory tree rooted at35[3Xdirectory_name[103X and returns the absolute path names of all occurrences of36this file as a list of strings.[133X3738[1X1.1-3 LoadedPackages[101X3940[29X[2XLoadedPackages[102X( ) [32X function4142[33X[0;0Yreturns a list with the names of the packages that have been loaded so far.43All this does is execute[133X4445[4X[32X Example [32X[104X46[4X[25Xgap>[125X [27XRecNames( GAPInfo.PackagesLoaded );[127X[104X47[4X[32X[104X4849[33X[0;0YYou might like to check out some of the other information in the [10XGAPInfo[110X50record (see [14X'Reference: GAPInfo'[114X).[133X5152[1X1.1-4 Which[101X5354[29X[2XWhich[102X( [3Xprg[103X ) [32X function5556[33X[0;0Yreturns the path of the program executed if [10XExec([3Xprg[103X[10X);[110X is called, e.g.[133X5758[4X[32X Example [32X[104X59[4X[25Xgap>[125X [27XWhich("date"); [127X[104X60[4X[28X"/bin/date"[128X[104X61[4X[25Xgap>[125X [27XExec("date");[127X[104X62[4X[28XFri 28 Jan 2011 16:22:53 GMT[128X[104X63[4X[32X[104X6465[1X1.1-5 WhereIsPkgProgram[101X6667[29X[2XWhereIsPkgProgram[102X( [3Xprg[103X ) [32X function6869[33X[0;0Yreturns a list of paths of programs with name [3Xprg[103X in the current packages70loaded. Try:[133X7172[4X[32X Example [32X[104X73[4X[25Xgap>[125X [27XWhereIsPkgProgram( "hello" );[127X[104X74[4X[32X[104X7576[1X1.1-6 HelloWorld[101X7778[29X[2XHelloWorld[102X( ) [32X function7980[33X[0;0Yexecutes the C program [10Xhello[110X provided by the [5XExample[105X package.[133X8182[1X1.1-7 FruitCake[101X8384[29X[2XFruitCake[102X[32X global variable8586[33X[0;0Yis a record with the bits and pieces needed to make a boiled fruit cake. Its87fields satisfy the criteria for [2XRecipe[102X ([14X1.1-8[114X).[133X8889[1X1.1-8 Recipe[101X9091[29X[2XRecipe[102X( [3Xcake[103X ) [32X operation9293[33X[0;0Ydisplays the recipe for cooking [3Xcake[103X, where [3Xcake[103X is a record satisfying94certain criteria explained here: its recognised fields are [10Xname[110X (a string95giving the type of cake or cooked item), [10XovenTemp[110X (a string), [10XcookingTime[110X (a96string), [10Xingredients[110X (a list of strings each containing an [10X_[110X which is used97to line up the entries and is replaced by a blank), [10Xmethod[110X (a list of steps,98each of which is a string or list of strings), and [10Xnotes[110X (a list of99strings). The global variable [2XFruitCake[102X ([14X1.1-7[114X) provides an example of such100a string.[133X101102103104