princ, print, pretty_princ, pretty_print

princ, print, pretty_princ, pretty_print — write to the standard output file.

Syntax

princ (s_exp...)
print (s_exp...)
pretty_princ (s_exp...)
pretty_print (s_exp...)

		

Arguments

s_exp

Any Gamma or Lisp expression.

Returns

t

Description

These functions write to the standard output file, typically the screen. The princ and pretty_princ functions produce formatted output, which means that special characters are not escaped, and double quotes are not printed around character strings. Output generated by princ cannot be read by the Lisp reader.

print and pretty_print produce Lisp-readable output. The result of reading a printed expression using a call to read will generate an equal expression.

pretty_princ and pretty_print generate carriage returns and spaces with the intention of formatting the output to make long or complex Lisp expressions easier for a person to read.

Examples

Gamma> x = "hello";
"hello"
Gamma> print (x,"\n");
"hello""\n"t
Gamma> princ (x,"\n");
hello
t
Gamma> >

Gamma> class C {a; b; c;}
(defclass C nil [][a b c])
Gamma> princ (C);
(defclass C nil [][a b c])t
Gamma> pretty_princ (C);
(defclass C nil 
[]
[a b c])t
Gamma> 

Gamma> L = list (1,2,3,4,5,list(1,2,3,4,5,list(1,2,3
list(1,2,3,4,5,list(1,2,3,4,5,list(1,2,3,4,5,list(1,2
,list(1,2,3,4,5,list(1,2,3,4,5)))))))))));
(1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4
4 5 (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5)))))
Gamma> princ (L);
(1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4
4 5 (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5)))))
Gamma> pretty_princ (L);

(1 2 3 4 5 
   (1 2 3 4 5 
      (1 2 3 4 5 
         (1 2 3 4 5 
            (1 2 3 4 5 
               (1 2 3 4 5 
                  (1 2 3 4 5 (1 2 3 4 5 (1 2 3 4 5 (
))))))))))t
Gamma> 
		

See Also

write, writec, pretty_write