Back to index
Symbols are printed in lower-case. There's no escape mechanism for
funny characters in symbols, as these cannot be input or generated.
Numbers are printed in decimal without leading zeros. If floating
point numbers don't have decimal places, the decimal point is
omitted, too. At most 15 decimal places are printed where the last
decimal digit may not be rounded correctly. Exponential notation
is used for numbers larger than 1015 or smaller than
10-4. (similar to the C format string "%.15g")
Big integers are printed in decimal if they're shorter than about
14000 decimal digits and in hexadecimal if they're larger (prefixed
by #x). The reason for this is that decimal conversion
takes quite a lot of time (proprtional to n2).
Complex numbers always print in rectangular form, where the real and
imaginary part are both printed as described for real numbers.
The special real
values infinity, -infinity
and not-a-number print as [inf], [-inf]
and [nan]. A complex number having an infinite component
prints as [cinf] (complex infinity).
print characters differently. write prefixes a character
with #\ or uses ## for characters with ASCII codes
<32 and display just prints the character itself.
print strings differently. display just prints the contents
of the string without any escape chars and without double quotes.
write encloses the string in double quotes and escapes the
characters ", \ and # with a backslash
\ and writes all characters with ASCII codes <32 in
Pairs and lists
The dot notation is avoided whenever possible. To avoid stack overflow
in the printer, deeply nested lists (the limit in configurable in the
print as [deep]. Expressions which are to long for the
output are abbreviated with ... and a
warning is given.
By selecting the option Print quotes,
you can make LispMe print quote-expressions in the abbreviated
Vectors are printed using the standard syntax #( ... ). The
depth limit (like with lists) applies to vectors, too.
A primitive (builtin) procedure prints as either
- [prim name] where name is the (standard)
name of the builtin procedure.
- [prim cxr code] for the special c[ad]+r
family of nested car or cdr applications. code
is a bitstring encoding the procedures being applied.
Closures print as [clos n], where n
indicates the number of arguments
See lambda for more info.
- n>=0 means exactly n arguments
- n<0 means at least |n|-1 arguments
(= |n| arguments, the last one being the rest argument)
Continuations (see call/cc)
print as [cont].
Promises (see delay)
not yet forced print as [dprom] and promises already forced
print as [fprom].
Output ports print as [outport type pos impl]
and input ports as
[inport type pos impl], where type is the
port type (see extend.h), pos is the current
read/write position, and impl is the underlying
implementation object. The special end-of-file
object (returned by read, for
example) prints as [eof].
Macros (see here)
print as [macro].
Unless a foreign type has registered an
own printing function, objects of this type are printed in a generic
way as [foreign type val], where type is the
numeric type code and val the 32 bit value in hexadecimal.
Summary of specially printed objects
|[date date]||PalmOS Date printed according to preferences|
|[dbref flags name]||an open PalmOS database|
|[deep]||deeply nested list or vector|
|[dprom]||a promise not yet forced|
|[file path]||an open VFS file|
|[foreign type val]||an object of user-defined type|
|[fprom]||a promise already forced|
|[hole]||a black hole|
|[inport type pos impl]||input port|
|[nan]||not a number|
|[outport type pos impl]||output port|
|[prim name]||the primitive
|[prim cxr code]||a primitive
|[serial id baud flags]||open serial port|
|[socket id]||TCP/IP socket|
|[strarr len]||string array (used internally)|
|[time time]||PalmOS Time printed according to preferences|
|[ts ts]||PalmOS Timestamp printed in standard format|
|[¬dbref]||a closed or invalid PalmOS database|
|[¬file]||a closed or invalid VFS file|
|[¬serial]||a closed or invalid serial port|
|[¬socket]||a closed or invalid TCP/IP socket|
|#gn||a symbol created by gensym|