Pretty printing
Pretty printing is the formatted rendering of structured information as human-readable text through layout, spacing, indentation, and line breaks.
Fabulous Adventures in Data Structures and Algorithms
Pretty printing is the automated formatting of source code to produce a readable layout under spacing and indentation constraints.
- How it is used
- Formats source code for consistent readability, structural indentation, bounded line width, and reduced vertical clutter.
- How deep it goes
- Descends from layout goals to parse-tree transformation, doc graphs, greedy rendering, explicit stacks, and visitor-based organization.
- Examples
- Uses irregularly spaced expressions, conditional statements, comments, delimited comments, and immutable C# expression-tree records.
- What you can do after
- Build it from scratch as a simplified, nonrecursive formatter with separate parse-tree, doc, rendering, and visitor layers.
Read how Fabulous Adventures in Data Structures and Algorithms explains pretty printing →
Clojure: The Essential Reference
Pretty printing is the generation of human-readable textual representations with structured layout and spacing.
- How it is used
- Improves REPL readability, source-code presentation, tabular display, and controlled output for large or nested values.
- How deep it goes
- Explains entry points, dispatch, dynamic controls, truncation, margins, streams, bases, and tables, without detailing printer internals.
- Examples
- Uses nested maps and collections, RSS XML data, Clojure forms, macroexpansion, numeric bases, output files, and printed tables.
- What you can do after
- Operate/configure clojure.pprint to display data, format code, constrain output, write streams, and render tables.
Read how Clojure: The Essential Reference explains pretty printing →
Learn Haskell by Example
Pretty printing is the rendering of structured information in a human-readable textual format.
- How it is used
- Uses pretty printing to render CSV data for users and add readable column summaries.
- How deep it goes
- Defines a PrettyCsv model and rendering interface, but leaves conversion, summaries, and formatting algorithms as exercises.
- Examples
- Uses PrettyCsv fields and fromCsv, withSummaries, pretty, and prettyText as concrete design examples.
- What you can do after
- Build it from scratch by converting Csv to PrettyCsv, adding summaries, and implementing textual rendering.
Read how Learn Haskell by Example explains pretty printing →
Related concepts
- formatterequivalent to · A formatter is a software tool that automatically transforms source code into a consistent textual layout according to specified formatting rules.
- parse treeuses · A parse tree is a hierarchical representation of the syntactic structure derived by parsing an expression, program, or structured document.
- greedy algorithmuses · A greedy algorithm builds a solution incrementally by choosing the locally best available option at each step, without generally accounting for all future consequences or revising prior choices.
- Documentproduced by · A discrete representation of information, such as content or a structured record, optionally accompanied by metadata.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


