Next: Data Sharing in Input Up: Support Facilities Previous: Input Parsing

# Output Printing

MzScheme's printer follows these non-standard rules:

- A vector can be printed by `write` and `print` using the shorthand described in section 14.3, where the vector's length is printed between the leading `#` and the opening parenthesis and repeated tail elements are omitted. For example, `#(1 2 2 2)` is printed as `#4(1 2)`. The `display` procedure does not output vectors using this shorthand. Shorthand vector printing is controlled with the `print-vector-length` Boolean parameter (see section 9.4.1.4). Shorthand vector printing is enabled by default.

- Boxes (see section 4.9) can be printed with the `#&` notation (see section 14.3). When box printing is disabled, all boxes are printed as `#<box>`. Box printing is controlled with the `print-box` Boolean parameter (see section 9.4.1.4). Box printing is enabled by default.

- Structures (see Chapter 5) can be printed using vector notation. In the vector, the first item is a symbol of the form `struct:s` -- where s is the name of the structure -- and the remaining elements are the elements of the structure. When structure printing is disabled, structures are printed as `#<struct:s>`. Structure printing is controlled with the `print-struct` Boolean parameter (see section 9.4.1.4). Structure printing is disabled by default.

- Symbols containing spaces or special characters `write` using escaping backslashes and quoting vertical bars. Symbols are quoted with vertical bars or a leading backslash when they would otherwise print the same as a numerical constant. If the value of the `read-accept-bar-quote` Boolean parameter is `#f` (see section 9.4.1.3), then backslashes are always used to escape special characters instead of quoting them with vertical bars, and a vertical bar is not treated as a special character. See section 14.3 for more information about symbol parsing. Symbols `display` without escaping or quoting special characters.

- Characters with the special names described in section 14.3 `write` using the same name. (Some characters have multiple names; the `#\newline` and `#\nul` names are used instead of `#\linefeed` and `#\null`). All other characters `write` as `#\` followed by the single-byte character value. All characters `display` as the single-byte character value.

- S-expressions with shared structure can be printed using `#n=` and `#n#`, where n is a decimal integer. See section 14.5.

Next: Data Sharing in Input Up: Support Facilities Previous: Input Parsing