[previous] [up] [next]     [index]
Next: Customizing Read Up: Ports Previous: Custom Ports

Reading and Printing

In addition to the standard reading procedures, MzScheme provides read-line, read-string, read-string-avail!, and read-string-avail!/enable-break:

In addition to the standard printing procedures, MzScheme provides print, which outputs values to a port by calling the port's print handler (see section 11.1.9), write-string-avail, and write-string-avail/enable-break:

Formatted output is written to a port with fprintf:

When an illegal format string is supplied to one of these procedures, the exn:application:type exception is raised. When the format string requires more additional arguments than are supplied, the exn:application:fprintf:mismatch exception is raised. When more additional arguments are supplied than are used by the format string, the exn:application:mismatch exception is raised.

For example,

  (fprintf port "~a as a string is ~s.~n" '(3 4) "(3 4)") 
prints this message to port:[footnote]
  (3 4) as a string is "(3 4)". 
followed by a newline.


[previous] [up] [next]     [index]
Next: Customizing Read Up: Ports Previous: Custom Ports

PLT