22.6. Printing Other Arrays
Prev | Chapter 22. Printer | Next

## 22.6. Printing Other Arrays [sec_22-1-3-8]

When `*PRINT-READABLY*` is true, other arrays are written as follows: if the `ARRAY-ELEMENT-TYPE` is `T`, the syntax ``#`rank`A` `contents`` is used. Otherwise, the syntax `#A(`element-type` `dimensions` `contents`)` is used.

As explicitly permitted by this section, specialized `BIT` and `CHARACTER` `ARRAY`s are printed with the innermost lists generated by the printing algorithm being instead printed using `BIT-VECTOR` and `STRING` syntax, respectively.

Variable `CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*`. Empty `ARRAY`s, i.e., arrays with no elements and zero `ARRAY-TOTAL-SIZE` (because one of its dimensions is zero) are printed with the readable syntax `#A(`element-type` `dimensions` `contents`)`, unless the variable `CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*` is non-`NIL`, in which case the arrays are printed using the [ANSI CL standard]-prescribed syntax ``#`rank`A` `contents`` which often loses the dimension information.

### 22.6.1. Printing Pathnames [sec_22-1-3-11]

Pathnames are printed as follows: If `*PRINT-ESCAPE*` is `NIL`, only the namestring is printed; otherwise it is printed with the `#P` syntax, as per the [ANSI CL standard] issue PRINT-READABLY-BEHAVIOR:CLARIFY. But, if `*PRINT-READABLY*` is true, we are in trouble as `#P` is ambiguous (which is verboten when `*PRINT-READABLY*` is true), while being mandated by the [ANSI CL standard]. Therefore, in this case, CLISP's behavior is determined by the value of `CUSTOM:*PRINT-PATHNAMES-ANSI*`: when it is `NIL`, we print pathnames like this: ``#-`CLISP `#P`"..." `#+`CLISP `#S`(`PATHNAME` ...)`. Otherwise, when the variable `CUSTOM:*PRINT-PATHNAMES-ANSI*` is non-`NIL`, the `#P` notation is used as per [sec_1-5-1-4-1] “Resolution of Apparent Conflicts in Exceptional Situations”.

### Note

The `#S` notation for `PATHNAME`s is used extensively in the [Common Lisp HyperSpec] (see examples for `PATHNAME`, `PATHNAMEP`, `PARSE-NAMESTRING` et al), but was decided against, see PATHNAME-PRINT-READ:SHARPSIGN-P.

### Warning

When both `*PRINT-READABLY*` and `CUSTOM:*PRINT-PATHNAMES-ANSI*` are non-`NIL` and the namestring will be parsed to a dissimilar object (with the current value of `CUSTOM:*PARSE-NAMESTRING-DOT-FILE*`), an `ERROR` of type `PRINT-NOT-READABLE` is `SIGNAL`ed.

| These notes document CLISP version 2.45 | Last modified: 2008-05-14

Enter your search termsSubmit search form
Webclisp.cons.orgclisp.podval.orgwww.lisp.org

Prev | Up | Next
22.5. Printing Other Vectors | Home | 22.7. The Lisp Pretty Printer