A pretty-printer for Clojure data structures.
Based on the algorithm described in "Pretty-Printing, Converting List to Linear Structure" by Ira Goldstein (Artificial Intelligence, Memo No. 279 in Massachusetts Institute of Technology A.I. Laboratory, February 1973).
Here's how the algorithm (as implemented in this namespace) works: given a form, if there is enough space remaining on the current line to print the entire form without any line breaks, do so. We call this style of printing the "linear" style. The printing functions (prn et al.) in clojure.core always print in the linear style.
If there is not enough room to print in the linear style, print the form in "miser" style instead. In the miser style, we insert a line break after each form (except map keys, if there is enough room to fit the entire value on the same line), and indent each form according to the current nesting level.
A pretty-printer for Clojure data structures. Based on the algorithm described in "Pretty-Printing, Converting List to Linear Structure" by Ira Goldstein (Artificial Intelligence, Memo No. 279 in Massachusetts Institute of Technology A.I. Laboratory, February 1973). Here's how the algorithm (as implemented in this namespace) works: given a form, if there is enough space remaining on the current line to print the entire form without any line breaks, do so. We call this style of printing the "linear" style. The printing functions (prn et al.) in clojure.core always print in the linear style. If there is not enough room to print in the linear style, print the form in "miser" style instead. In the miser style, we insert a line break after each form (except map keys, if there is enough room to fit the entire value on the same line), and indent each form according to the current nesting level.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close