next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: File << Thing

File << Thing -- print to a file

Synopsis

Description

Parsing of << associates leftward, so that several objects may be displayed with an expression such as f<<x<<y<<z.

i1 : stderr << "-- hi there --" << endl
-- hi there --

o1 = stderr

o1 : File
i2 : << "-- ho there --" << endl
-- ho there --

o2 = stdio

o2 : File
i3 : fn = temporaryFileName()

o3 = /tmp/M2-29767-0/0
i4 : fn << "hi there" << endl << close

o4 = /tmp/M2-29767-0/0

o4 : File
i5 : get fn

o5 = hi there
i6 : R = QQ[x]

o6 = R

o6 : PolynomialRing
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
i8 : << 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
i9 : fn << f << close

o9 = /tmp/M2-29767-0/0

o9 : File
i10 : get fn

o10 =  10      9      8       7       6       5       4       3      2
      x   + 10x  + 45x  + 120x  + 210x  + 252x  + 210x  + 120x  + 45x  + 10x
      + 1
i11 : fn << toExternalString f << close

o11 = /tmp/M2-29767-0/0

o11 : File
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
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
i14 : removeFile fn

See also