GNU Info

Info Node: (elisp)Printed Representation

(elisp)Printed Representation


Next: Comments Up: Lisp Data Types
Enter node , (file) or (file)node

Printed Representation and Read Syntax
======================================

   The "printed representation" of an object is the format of the
output generated by the Lisp printer (the function `prin1') for that
object.  The "read syntax" of an object is the format of the input
accepted by the Lisp reader (the function `read') for that object.
Note: Read and Print.

   Most objects have more than one possible read syntax.  Some types of
object have no read syntax, since it may not make sense to enter objects
of these types directly in a Lisp program.  Except for these cases, the
printed representation of an object is also a read syntax for it.

   In other languages, an expression is text; it has no other form.  In
Lisp, an expression is primarily a Lisp object and only secondarily the
text that is the object's read syntax.  Often there is no need to
emphasize this distinction, but you must keep it in the back of your
mind, or you will occasionally be very confused.

   Every type has a printed representation.  Some types have no read
syntax--for example, the buffer type has none.  Objects of these types
are printed in "hash notation": the characters `#<' followed by a
descriptive string (typically the type name followed by the name of the
object), and closed with a matching `>'.  Hash notation cannot be read
at all, so the Lisp reader signals the error `invalid-read-syntax'
whenever it encounters `#<'.

     (current-buffer)
          => #<buffer objects.texi>

   When you evaluate an expression interactively, the Lisp interpreter
first reads the textual representation of it, producing a Lisp object,
and then evaluates that object (Note: Evaluation).  However,
evaluation and reading are separate activities.  Reading returns the
Lisp object represented by the text that is read; the object may or may
not be evaluated later.  Note: Input Functions, for a description of
`read', the basic function for reading objects.


automatically generated by info2www version 1.2.2.9