Skip to main content

*print-array*

print-array∗ Variable

Value Type:

a generalized boolean.

Initial Value:

implementation-dependent.

Description:

Controls the format in which arrays are printed. If it is false, the contents of arrays other than strings are never printed. Instead, arrays are printed in a concise form using #< that gives enough information for the user to be able to identify the array, but does not include the entire array contents. If it is true, non-string arrays are printed using #(...), #*, or #nA syntax.

Affected By:

The implementation.

See Also:

Section 2.4.8.3 (Sharpsign Left-Parenthesis), Section 2.4.8.20 (Sharpsign Less-Than-Sign) print-base,

Expanded Reference: *print-array*

When True -- Print Array Contents

When *print-array* is true, arrays (other than strings) are printed using readable syntax such as #(...) for vectors and #nA(...) for multidimensional arrays.

(let ((*print-array* t))
(write-to-string #(1 2 3)))
=> "#(1 2 3)"

(let ((*print-array* t))
(write-to-string (make-array '(2 3) :initial-contents '((1 2 3) (4 5 6)))))
=> "#2A((1 2 3) (4 5 6))"

When False -- Concise Representation

When *print-array* is false, arrays are printed in a concise, unreadable #<...> form that does not include the contents.

(let ((*print-array* nil))
(write-to-string #(1 2 3)))
;; => "#<(SIMPLE-VECTOR 3) ...>" ; implementation-dependent

Strings Are Not Affected

Strings are always printed as strings regardless of *print-array*.

(let ((*print-array* nil))
(write-to-string "hello"))
=> "\"hello\""

Bit Vectors

Bit vectors use #* syntax when *print-array* is true.

(let ((*print-array* t))
(write-to-string #*1010))
=> "#*1010"