<?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>Print -- top level method for printing results</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_print.html">next</a> | <a href="___Primitive__Element.html">previous</a> | <a href="_print.html">forward</a> | <a href="___Primitive__Element.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>Print -- top level method for printing results</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>X#{Standard,Print} = f</tt></div> </dd></dl> </div> </li> <li><div class="single">Inputs:<ul><li><span><tt>X</tt>, <span>a <a href="___Type.html">type</a></span></span></li> <li><span><tt>f</tt>, <span>a <a href="___Function.html">function</a></span>, that can print something of type <tt>X</tt></span></li> </ul> </div> </li> <li><div class="single">Consequences:<ul><li>at top level, whenever it is time to print an output value of type <tt>X</tt>, the function <tt>f</tt> will be called</li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div>The function <tt>f</tt> is responsible for printing the output prompt and for applying the <a href="___Before__Print.html" title="top level method applied before printing results">BeforePrint</a> and <a href="___After__Print.html" title="top level method applied after printing">AfterPrint</a> methods, if desired.<table class="examples"><tr><td><pre>i1 : code Thing#{Standard,Print} o1 = /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/m2/robust.m2:130:28-146:19: --source code: Thing#{Standard,Print} = x -> ( oprompt := concatenate(interpreterDepth:"o", toString lineNumber, " = "); save := printWidth; if printWidth != 0 then printWidth = printWidth - #oprompt; z := robustNet x; wrapper := lookup(symbol Wrap,class x); if wrapper =!= null then ( fun := () -> z = wrapper z; try timelimit(printingTimeLimit, fun) else ( alarm 0; global debugError <- fun; stderr << "--error or time limit reached in applying Wrap method to output; type 'debugError()' to see it" << endl << endl); ); << endl << oprompt << z << endl; printWidth = save; )</pre> </td></tr> </table> </div> </div> <div class="waystouse"><h2>For the programmer</h2> <p>The object <a href="___Print.html" title="top level method for printing results">Print</a> is <span>a <a href="___Symbol.html">symbol</a></span>.</p> </div> </div> </body> </html>