[previous] [up] [next]


6.6.3 Output

Procedure:  (write obj)
Procedure:  (write obj port)

Writes a written representation of obj to the given port. Strings that appear in the written representation are enclosed in doublequotes, and within those strings backslash and doublequote characters are escaped by backslashes. Character objects are written using the #\ notation. Write returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

Procedure:  (display obj)
Procedure:  (display obj port)

Writes a representation of obj to the given port. Strings that appear in the written representation are not enclosed in doublequotes, and no characters are escaped within those strings. Character objects appear in the representation as if written by write-char instead of by write. Display returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

Rationale: Write is intended for producing machine-readable output and display is for producing human-readable output. Implementations that allow "slashification" within symbols will probably want write but not display to slashify funny characters in symbols.

Procedure:  (newline)
Procedure:  (newline port)

Writes an end of line to port. Exactly how this is done differs from one operating system to another. Returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

Procedure:  (write-char char)
Procedure:  (write-char char port)

Writes the character char (not an external representation of the character) to the given port and returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.