Sophie

Sophie

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

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>File &lt;&lt; Thing -- print to a file</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_file__Dictionaries.html">next</a> | <a href="___File.html">previous</a> | <a href="_file__Dictionaries.html">forward</a> | <a href="___File.html">backward</a> | up | <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>
<hr/>
<div><h1>File &lt;&lt; Thing -- print to a file</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>f &lt;&lt; x</tt><br/><tt>  &lt;&lt; x</tt></div>
</dd></dl>
</div>
</li>
<li><span>Operator: <a href="__lt_lt.html" title="a binary operator (file output, ...)">&lt;&lt;</a></span></li>
<li><div class="single">Inputs:<ul><li><span><tt>f</tt>, <span>a <a href="___File.html">file</a></span>, <span>a <a href="___String.html">string</a></span>, <span>a <a href="___List.html">list</a></span>, or <a href="_null.html" title="the unique member of the empty class">null</a></span></li>
<li><span><tt>x</tt>, <span>a <a href="___Thing.html">thing</a></span></span></li>
</ul>
</div>
</li>
<li><div class="single">Consequences:<ul><li>The object <tt>x</tt> is prepared for printing (with <a href="_net.html" title="format for printing, as a net">net</a>) and printed on the output file(s) <tt>f</tt>.  If <tt>f</tt> is a string, then it is interpreted as a filename and an output file is opened, used, and returned, unless a single open file with the same name already exists, in which case it is used and returned.  Filenames starting with <tt>!</tt> or with <tt>$</tt> are treated specially, see <a href="_open__In__Out.html" title="open an input output file">openInOut</a>.  If <tt>f</tt> is a list, then the output operation is performed on each one.  If <tt>f</tt> is <a href="_null.html" title="the unique member of the empty class">null</a>, then the output is discarded; thus <a href="_null.html" title="the unique member of the empty class">null</a> is useful as a dummy output file.  If <tt>f</tt> is omitted, as in the second usage line, then the output is sent to <a href="_stdio.html" title="the standard input output file">stdio</a>, and it will appear (usually) on the screen.</li>
</ul>
</div>
</li>
<li><div class="single">Outputs:<ul><li><span><span>a <a href="___File.html">file</a></span>, the output file(s) used</span></li>
</ul>
</div>
</li>
</ul>
</div>
<div class="single"><h2>Description</h2>
<div><p>Parsing of <a href="__lt_lt.html" title="a binary operator (file output, ...)">&lt;&lt;</a> associates leftward, so that several objects  may be displayed with an expression such as <tt>f&lt;&lt;x&lt;&lt;y&lt;&lt;z</tt>.</p>
<table class="examples"><tr><td><pre>i1 : stderr &lt;&lt; "-- hi there --" &lt;&lt; endl
-- hi there --

o1 = stderr

o1 : File</pre>
</td></tr>
<tr><td><pre>i2 : &lt;&lt; "-- ho there --" &lt;&lt; endl
-- ho there --

o2 = stdio

o2 : File</pre>
</td></tr>
<tr><td><pre>i3 : fn = temporaryFileName()

o3 = /tmp/M2-22789-1</pre>
</td></tr>
<tr><td><pre>i4 : fn &lt;&lt; "hi there" &lt;&lt; endl &lt;&lt; close

o4 = /tmp/M2-22789-1

o4 : File</pre>
</td></tr>
<tr><td><pre>i5 : get fn

o5 = hi there</pre>
</td></tr>
<tr><td><pre>i6 : R = QQ[x]

o6 = R

o6 : PolynomialRing</pre>
</td></tr>
<tr><td><pre>i7 : f = (x+1)^10

      10      9      8       7       6       5       4       3      2
o7 = x   + 10x  + 45x  + 120x  + 210x  + 252x  + 210x  + 120x  + 45x  + 10x +
     ------------------------------------------------------------------------
     1

o7 : R</pre>
</td></tr>
<tr><td><pre>i8 : &lt;&lt; f
 10      9      8       7       6       5       4       3      2
x   + 10x  + 45x  + 120x  + 210x  + 252x  + 210x  + 120x  + 45x  + 10x + 1
o8 = stdio

o8 : File</pre>
</td></tr>
<tr><td><pre>i9 : fn &lt;&lt; f &lt;&lt; close

o9 = /tmp/M2-22789-1

o9 : File</pre>
</td></tr>
<tr><td><pre>i10 : get fn

o10 =  10      9      8       7       6       5       4       3      2
      x   + 10x  + 45x  + 120x  + 210x  + 252x  + 210x  + 120x  + 45x  + 10x
      + 1</pre>
</td></tr>
<tr><td><pre>i11 : fn &lt;&lt; toExternalString f &lt;&lt; close

o11 = /tmp/M2-22789-1

o11 : File</pre>
</td></tr>
<tr><td><pre>i12 : get fn

o12 = x^10+10*x^9+45*x^8+120*x^7+210*x^6+252*x^5+210*x^4+120*x^3+45*x^2+10*x+
      1</pre>
</td></tr>
<tr><td><pre>i13 : value get fn

       10      9      8       7       6       5       4       3      2
o13 = x   + 10x  + 45x  + 120x  + 210x  + 252x  + 210x  + 120x  + 45x  + 10x
      -----------------------------------------------------------------------
      + 1

o13 : R</pre>
</td></tr>
<tr><td><pre>i14 : removeFile fn</pre>
</td></tr>
</table>
</div>
</div>
<div class="single"><h2>See also</h2>
<ul><li><span><a href="_stdio.html" title="the standard input output file">stdio</a> -- the standard input output file</span></li>
<li><span><a href="_stderr.html" title="the standard error output file">stderr</a> -- the standard error output file</span></li>
<li><span><a href="_endl.html" title="end an output line">endl</a> -- end an output line</span></li>
<li><span><a href="_close.html" title="close a file">close</a> -- close a file</span></li>
</ul>
</div>
</div>
</body>
</html>