Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 4010

Macaulay2-1.3.1-8.fc15.i686.rpm

<?xml version="1.0" encoding="utf-8" ?>  <!-- for emacs: -*- coding: utf-8 -*- -->
<!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"	 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>an example of a package</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_new__Package_lp__String_rp.html">next</a> | <a href="_creating_spa_sppackage.html">previous</a> | <a href="_new__Package_lp__String_rp.html">forward</a> | backward | <a href="_creating_spa_sppackage.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div>

    </td>
  </tr>
</table>
<div><a href="index.html" title="">Macaulay2Doc</a> > <a href="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_packages.html" title="">packages</a> > <a href="_creating_spa_sppackage.html" title="">creating a package</a> > <a href="_an_spexample_spof_spa_sppackage.html" title="">an example of a package</a></div>
<hr/>
<div><h1>an example of a package</h1>
<div>Here is a basic example of a complete package:<table class="examples"><tr><td><pre>-- -*- coding: utf-8 -*-
newPackage(
        "FirstPackage",
        Version => "1.0", 
        Date => "February 11, 2004",
        Authors => {{Name => "Jane Doe", 
                  Email => "doe@math.uiuc.edu", 
                  HomePage => "http://www.math.uiuc.edu/~doe/"}},
        Headline => "an example Macaulay2 package",
        DebuggingMode => true
        )

export {firstFunction}

firstFunction = method(TypicalValue => String)
firstFunction ZZ := String => n -> if n == 1 then "Hello World!" else "D'oh!"

beginDocumentation()
document { 
        Key => FirstPackage,
        Headline => "an example Macaulay2 package",
        EM "FirstPackage", " is a basic package to be used as an example."
        }
document {
        Key => {(firstFunction,ZZ),firstFunction},
        Headline => "a silly first function",
        Usage => "firstFunction n",
        Inputs => { "n" },
        Outputs => {{ "a silly string, depending on the value of ", TT "n" }},
        SourceCode => {(firstFunction,ZZ)},
        EXAMPLE lines ///
           firstFunction 1
           firstFunction 0
        ///
        }

TEST ///
    assert ( firstFunction 2 == "D'oh!" )
///</pre>
</td></tr>
</table>
</div>
<div class="single"><h2>See also</h2>
<ul><li><span><a href="_packages.html" title="">packages</a></span></li>
<li><span><a href="_new__Package_lp__String_rp.html" title="package item: start a new package">newPackage</a> -- package item: start a new package</span></li>
<li><span><a href="_export.html" title="package item: export functions">export</a> -- package item: export functions</span></li>
<li><span><a href="_export__Mutable.html" title="package item: export writable variables">exportMutable</a> -- package item: export writable variables</span></li>
<li><span><a href="_begin__Documentation.html" title="package item: start documentation section">beginDocumentation</a> -- package item: start documentation section</span></li>
<li><span><a href="_document.html" title="package item: documentation node">document</a> -- package item: documentation node</span></li>
<li><span><a href="___T__E__S__T.html" title="package item: register a test of the package">TEST</a> -- package item: register a test of the package</span></li>
</ul>
</div>
</div>
</body>
</html>