Node: Output, Next: , Previous: Input, Up: Input and Output



Output

write obj R5RS
write obj port R5RS
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.

write* obj STKLOS Procedure
write* obj port STKLOS Procedure
Writes a written representation of obj to the given port. The main difference with the write procedure is that write* handles data structures with cycles. Circular structure written by this procedure use the "#n=" and "#n#" notations (see circular structure).

write-with-shared-structure obj STKLOS Procedure
write-with-shared-structure obj port STKLOS Procedure
write-with-shared-structure obj port optarg STKLOS Procedure
write-with-shared-structure has been added to be compatible with SRFI-38. It is is identical to write*, except that it accepts one more parameter (optarg). This parameter, which is not specified in SRFI-38, is always ignored.

display obj R5RS
display obj port R5RS
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.

newline R5RS
newline port R5RS
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.

write-char char R5RS
write-char char port R5RS
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.

format port str obj ... STKLOS Procedure
format str obj STKLOS Procedure
Writes the objs to the given port, according to the format string str. Str is written literally, except for the following sequences:
  • ~a or ~A is replaced by the printed representation of the next obj.
  • ~s or ~S is replaced by the "slashified" printed representation of the next obj.
  • ~w or ~W is replaced by the printed representation of the next obj (circular structures are correctly handled and printed using writes*).
  • ~~ is replaced by a single tilde character.
  • ~% is replaced by a newline

Port can be a boolean or a port. If port is #t, output goes to the current output port; if port is #f, the output is returned as a string. Otherwise, the output is printed on the specified port.

             (format #f "A test.")       => "A test."
             (format #f "A ~a." "test")  => "A test."
             (format #f "A ~s." "test")  => "A \"test\"."
          

The second form of format is compliant with SRFI-28. That is, when port is omitted, the output is returned as a string as if port was given the value #f.

flush STKLOS Procedure
flush port STKLOS Procedure
Flushes the buffer associated with the given output port. The port argument may be omitted, in which case it defaults to the value returned by current-output-port