Sophie

Sophie

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

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>needsPackage -- load a package if not already loaded</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_load__Package.html">next</a> | <a href="_packages.html">previous</a> | <a href="_load__Package.html">forward</a> | backward | <a href="_packages.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="_needs__Package.html" title="load a package if not already loaded">needsPackage</a></div>
<hr/>
<div><h1>needsPackage -- load a package if not already loaded</h1>
<div class="single"><h2>Synopsis</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>needsPackage "PACKAGENAME"</tt></div>
</dd></dl>
</div>
</li>
<li><div class="single">Inputs:<ul><li><span><tt>PACKAGENAME</tt>, the name of the package</span></li>
</ul>
</div>
</li>
<li><div class="single">Consequences:<ul><li>Loads the package <tt>PACKAGENAME</tt> in the file <tt>PACKAGENAME.m2</tt></li>
</ul>
</div>
</li>
<li><div class="single">Outputs:<ul><li><span>either the <a href="___Package.html" title="the class of all packages">Package</a> just loaded, or <a href="_null.html" title="the unique member of the empty class">null</a> if the package has already been loaded.</span></li>
</ul>
</div>
</li>
<li><div class="single"><a href="_using_spfunctions_spwith_spoptional_spinputs.html">Optional inputs</a>:<ul><li><span><tt>FileName => </tt><span><span>a <a href="___String.html">string</a></span>, <span>default value null</span>, the name of the file containing the source code of the package, from which it should be loaded</span></span></li>
<li><span><tt>LoadDocumentation => </tt><span><span>a <a href="___Boolean.html">Boolean value</a></span>, <span>default value false</span>, whether to load the documentation of the package, too; see <a href="_begin__Documentation.html" title="package item: start documentation section">beginDocumentation</a></span></span></li>
<li><span><tt>DebuggingMode => </tt><span><span>a <a href="___Boolean.html">Boolean value</a></span>, <span>default value null</span>, the value of <a href="_debugging__Mode.html" title="whether to enter the debugger when an error occurs">debuggingMode</a> during loading the package; specifying it here overrides the value specified as an option to <a href="_new__Package_lp__String_rp.html" title="package item: start a new package">newPackage</a> by the package itself</span></span></li>
<li><span><tt>Configuration => </tt><span><span>a <a href="___List.html">list</a></span>, <span>default value {}</span>, a list of options <tt>KEY => VALUE</tt>, overriding the defaults specified in the source code of the package and the (possibly updated) values in the file in the user's application directory.</span></span></li>
</ul>
</div>
</li>
</ul>
</div>
<div class="single"><h2>Description</h2>
<div><p>The file <tt>PACKAGENAME.m2</tt> should be on the load <a href="_path.html" title="list of directories to look in">path</a> and should contain a package named <tt>PACKAGENAME</tt>.</p>
<p>For example, to load the sample package <tt>FirstPackage</tt>:</p>
<p>If the variable <a href="_notify.html" title="whether to notify the user when a file is loaded">notify</a> is set to true, then an informational message is displayed after the file is loaded.</p>
<table class="examples"><tr><td><pre>i1 : notify = true

o1 = true</pre>
</td></tr>
<tr><td><pre>i2 : needsPackage "FirstPackage"
--database not present: /builddir/build/BUILD/Macaulay2-1.3.1-r10737/StagingArea/common/lib/Macaulay2/i686-Linux-Fedora-15/FirstPackage/cache/rawdocumentation-dcba-4.db
--beginDocumentation: reading the rest of /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/packages/FirstPackage.m2
--package "FirstPackage" loaded
--loaded /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/packages/FirstPackage.m2

o2 = FirstPackage

o2 : Package</pre>
</td></tr>
<tr><td><pre>i3 : needsPackage "FirstPackage"

o3 = FirstPackage

o3 : Package</pre>
</td></tr>
</table>
The second time the package was not reloaded.</div>
</div>
<div class="single"><h2>See also</h2>
<ul><li><span><a href="_packages.html" title="">packages</a></span></li>
<li><span><a href="_an_spexample_spof_spa_sppackage.html" title="">an example of a package</a></span></li>
<li><span><a href="_load__Package.html" title="load a package">loadPackage</a> -- load a package</span></li>
</ul>
</div>
<div class="waystouse"><h2>Ways to use <tt>needsPackage</tt> :</h2>
<ul><li>needsPackage(String)</li>
</ul>
</div>
</div>
</body>
</html>