5.4 Printing and messages

For printing in symbolic mode you can use the Standard LISP functions



print(u)print u with LISP syntax and following linefeed
prin1(u)print u with LISP syntax but without linefeed
prin2(u)print u without LISP syntax and without linefeed
prin2t(u)print u without LISP syntax but with linefeed
terpri()print a single linefeed


LISP syntax here means that a string is surrounded by string quotes and special characters in a symbol are tagged by an exclamation mark.

However if you want to print an algebraic expression in the same style as the REDUCE write statement you should use the function writepri. This function needs two arguments, the first one is the object to be printed which must be a string, a number or an algebraic expresssion tagged with a dynamic quote, e.g. using the function mkquote. The second argument is one of only, first, nil, and last and controls linefeeds. Example:

  <<u:=’(expt x 2);  
    writepri(" u= ",’first);  
    writepri(mkquote u,nil);  
    writepri(" printed in algebraic style",’last);  
  >>;

For printing one single algebraic form you can also use the function mathprint:

    u := ’(expt x 3);  
    print u;  
    mathprint u;