Node: Printed Representation of Lpp Objects, Next: , Previous: Input Output, Up: Input Output

Printed Representation of Lpp Objects

All predefined Lpp objects have prin1 and princ methods that print the object as you would expect in Common Lisp. For example the following code for printing some Lpp objects

     prin1(L("Hello world"); terpri();
     princ(L("Hello world");
     print(cons(S(a), S(b)));

would produce on cout

     "Hello world"
     Hello world
     (a . b)

As described in this manual, See Accessing Type Meta-Objects, the programmer can dynamically set the prin1 and princ methods of his objects. All Lpp objects whose prin1 and princ methods have not been set have default print methods which prints the object as

     <description  address>

where description describes the type of the object and address is the address in memory where the object is allocated.

defaultPrin1Address Variable

The defaultPrin1Address global variable when non-nil will cause the default printing of objects to print as


that is leaving out the address part. This is useful for things like regression tests on program output where the same output is expected from one run to another.

The value of defaultPrin1Address defaults to t.