liveBook · Manning

*print-radix*

As explained in Clojure: The Essential Reference

*print-radix* is a Clojure dynamic variable controlling whether radix prefixes are printed for non-decimal numeric bases.

*print-radix* controls whether Clojure prints radix prefixes when numbers use non-decimal bases. It works with *print-base* during pretty printing. section 23.20

It prints these prefixes for supported bases:

Making hexadecimal output self-identifying

(binding [pprint/*print-base* 16 pprint/*print-radix* true] (pprint/pprint 3405691582)) ;; #xcafebabe section 23.20

Table 23.1. The dynamic variables related to pretty printing

Name

Namespace

Default

Description

*print-readably*

clojure.core

true

Print escape sequences literally.

*print-dup*

clojure.core

false

Print objects so they can be read back into memory.

*print-length*

clojure.core

nil

Number of items to print in a collection.

*print-level*

clojure.core

nil

Number of nesting collections level to print.

*print-meta*

clojure.core

false

Should metadata be printed as part of the object.

*print-pretty*

clojure.pprint

true

Enable/disable pretty printing.

*print-pprint-dispatch*

clojure.pprint

fn

Set pretty printer dispatch function.

*print-right-margin*

clojure.pprint

72

Number of columns to use before breaking into a newline.

*print-miser-width*

clojure.pprint

40

The column at which to enter miser style.

*print-suppress-namespaces*

clojure.pprint

nil

Remove namespace qualifier from symbols.

*print-radix*

clojure.pprint

nil

Print radix used for integers or ratio.

*print-base*

clojure.pprint

10

Change base for printing integers or ratio.

Compare *print-radix* with related dynamic variables that control readability, collection limits, metadata, and pretty-printing behavior. section 23.20

How Clojure: The Essential Reference covers it

How deep it goes
Defines markers for bases 2, 8, and 16 without describing printer internals or conversion algorithms.
Examples
Demonstrates hexadecimal output for 3405691582 as #xcafebabe using binding.
What you can do after
Apply it via binding to make hexadecimal output visibly identify its numeric base.
How it connects
Links *print-base* with pretty printing and Clojure dynamic variables.

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.