Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 91213ddcfbe7f54821d42c2d9e091326 > files > 977

gap-system-packages-4.4.12-5mdv2010.0.i586.rpm

<html><head><title>[Example] 1 The Example Package</title></head>
<body text="#000000" bgcolor="#ffffff">
[<a href = "chapters.htm">Up</a>] [<a href ="CHAP002.htm">Next</a>] [<a href = "theindex.htm">Index</a>]
<h1>1 The Example Package</h1><p>
<P>
<H3>Sections</H3>
<oL>
<li> <A HREF="CHAP001.htm#SECT001">The main functions</a>
</ol><p>
<p>
<a name = "I0"></a>

This chapter  describes  the  <font face="Gill Sans,Helvetica,Arial">GAP</font>  package  <font face="Gill Sans,Helvetica,Arial">Example</font>.  As  its  name
suggests it is an example of how to  create  a  <font face="Gill Sans,Helvetica,Arial">GAP</font>  package.  It  has
little functionality except for being a package.
<p>
See Sections&nbsp;<a href="CHAP002.htm#SECT001">Installing the Example Package</a>  and&nbsp;<a href="CHAP002.htm#SECT002">Loading  the  Example Package</a>  for  how  to  install  and  load  the  <font face="Gill Sans,Helvetica,Arial">Example</font>  package,  or
Appendix&nbsp;<a href="CHAP00A.htm">Hints for writing a GAP Package</a> for hints on how  to  write  a
<font face="Gill Sans,Helvetica,Arial">GAP</font> package.
<p>
If you are viewing this with on-line help, type: 
<p>
<pre>
gap&gt; ?&gt;
</pre>
<p>
to see the functions provided by the <font face="Gill Sans,Helvetica,Arial">Example</font> package.
<p>
<p>
<h2><a name="SECT001">1.1 The main functions</a></h2>
<p><p>
The following functions are available:
<p>
<a name = "SSEC001.1"></a>
<li><code>ListDirectory([</code><var>dir</var><code>]) F</code>
<p>
lists the files in directory <var>dir</var> (a string) or the current directory if
called with no arguments.
<p>
<a name = "SSEC001.2"></a>
<li><code>FindFile( </code><var>directory_name</var><code>, </code><var>file_name</var><code> ) F</code>
<p>
searches  for the  file   <var>file_name</var> in  the  directory  tree  rooted at
<var>directory_name</var> and returns the absolute path names of  all  occurrences
of this file as a list of strings.
<p>
<a name = "SSEC001.3"></a>
<li><code>LoadedPackages() F</code>
<p>
returns a list with the names of the packages that have  been  loaded  so
far. All this does is execute
<p>
<pre>
gap&gt; RecNames( GAPInfo.PackagesLoaded );
</pre>
<p>
You might like to check out some of the other information in the <code>GAPInfo</code>
record.
<p>
<a name = "SSEC001.4"></a>
<li><code>Which( </code><var>prg</var><code> ) F</code>
<p>
returns the path of the program executed if <code>Exec(</code><var>prg</var><code>);</code> is called, e.g.
<p>
<pre>
gap&gt; Which("date");         
"/bin/date"
gap&gt; Exec("date");
Sun Oct  7 16:23:45 CEST 2001
</pre>
<p>
<a name = "SSEC001.5"></a>
<li><code>WhereIsPkgProgram( </code><var>prg</var><code> ) F</code>
<p>
returns a list of paths of  programs  with  name  <var>prg</var>  in  the  current
packages loaded. Try:
<p>
<pre>
gap&gt; WhereIsPkgProgram( "hello" );
</pre>
<p>
<a name = "SSEC001.6"></a>
<li><code>HelloWorld() F</code>
<p>
executes the C program <code>hello</code> provided by the <font face="Gill Sans,Helvetica,Arial">Example</font> package.
<p>
<a name = "SSEC001.7"></a>
<li><code>FruitCake V</code>
<p>
is a record with the bits and pieces needed to make a boiled fruit  cake.
Its fields satisfy the criteria for <code>Recipe</code> (see&nbsp;<a href="CHAP001.htm#SSEC001.8">Recipe</a>);
<p>
<a name = "SSEC001.8"></a>
<li><code>Recipe( </code><var>cake</var><code> ) M</code>
<p>
displays the recipe for cooking <var>cake</var>, where <var>cake</var>  is  a  record.  The
fields of <var>cake</var> recognised are <code>name</code> (a string giving the type of  cake
or  cooked  item),  <code>ovenTemp</code>  (a  string),  <code>cookingTime</code>  (a  string),
<code>ingredients</code> (a list of strings each containing an <code>_</code> which is used  to
line up the entries and is replaced by a  blank),  <code>method</code>  (a  list  of
steps, each of which is a string or list of strings), and <code>notes</code> (a list
of strings).
<p>
<p>
[<a href = "chapters.htm">Up</a>] [<a href ="CHAP002.htm">Next</a>] [<a href = "theindex.htm">Index</a>]
<P>
<address>Example manual<br>Januar 2006
</address></body></html>