liveBook · Manning

*print-pretty*

As explained in Clojure: The Essential Reference

*print-pretty* is a Clojure dynamic variable that enables or disables pretty-print formatting.

*print-pretty* is a Clojure dynamic variable and the main on/off switch for pretty printing. It defaults to true, producing human-readable layouts; disabling it keeps the printed representation compact. section 23.20

Disable formatting locally

(require '[clojure.pprint :as pprint]) (binding [pprint/*print-pretty* false] (pprint/write (range 100))) ;; (0 1 2 ... 99)nil Without the binding, the same collection is laid out across lines. Use alter-var-root to change the setting globally, then restore it when needed.

How Clojure: The Essential Reference covers it

How deep it goes
Explains the default, local binding, and global root alteration, but defers the formatter’s internal implementation.
Examples
Uses pprint/write on (range 100), contrasting multiline output with compact output under binding.
What you can do after
Apply it via binding for scoped output changes or alter-var-root for a process-wide default.
How it connects
Connects pretty printing with dynamic variables, pprint dispatch, collection truncation, and right-margin formatting.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.