liveBook · Manning

*print-right-margin*

As explained in Clojure: The Essential Reference

*print-right-margin* is a Clojure dynamic variable specifying the preferred maximum number of columns for a pretty-printed line.

*print-right-margin* is a Clojure dynamic variable in clojure.pprint that sets the preferred number of columns before pretty printing breaks a line. Its default is 72. section 23.20

Force narrower output

Pretty-printing eight repeated words at the default margin produces one line. Bind the margin to 60 to place each word on its own line: (binding [pprint/*print-right-margin* 60] (print-with-length (words 8))) The binding changes formatting locally without changing the variable globally.

The margin guides line breaking rather than simply cutting text at a fixed character position: clojure.pprint adds spaces, parentheses, and other formatting artifacts while choosing readable breaks. For deeply nested source code, combine it with *print-miser-width*. section 23.20

How Clojure: The Essential Reference covers it

How deep it goes
Explains the default, local binding, and line-breaking effect, while deferring the pretty printer’s internal algorithms.
Examples
Uses repeated words and nested condp forms to demonstrate ordinary and source-code line wrapping.
What it assumes
Assumes familiarity with clojure.pprint, pprint/pprint, and dynamic binding.
What you can do after
Operate/configure pretty printing by locally binding a margin suited to the desired output width.
How it connects
Connects pretty printing with dynamic variables, *print-miser-width*, and pprint/code-dispatch.

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.