|
1 | 1 | (ns basilisp.pprint
|
2 |
| - "Basilisp pretty printer |
3 |
| - |
4 |
| - Pretty Printing |
5 |
| - --------------- |
6 |
| - |
7 |
| - Pretty printing built-in data structures is as easy as a call to :lpy:fn:`pprint`. |
8 |
| - |
9 |
| - .. code-block:: |
10 |
| - |
11 |
| - (require '[basilisp.pprint :as pprint]) |
12 |
| - (pprint/pprint (range 30)) |
13 |
| - |
14 |
| - The output can be configured using a number of different control variables, which |
15 |
| - are expressed as dynamic Vars. |
16 |
| - |
17 |
| - - :lpy:fn:`*print-base*` |
18 |
| - - :lpy:fn:`*print-miser-width*` |
19 |
| - - :lpy:fn:`*print-pretty*` |
20 |
| - - :lpy:fn:`*print-pprint-dispatch*` |
21 |
| - - :lpy:fn:`*print-radix*` |
22 |
| - - :lpy:fn:`*print-right-margin*` |
23 |
| - - :lpy:fn:`*print-sort-keys*` |
24 |
| - - :lpy:fn:`*print-suppress-namespaces*` |
25 |
| - |
26 |
| - You can pretty print the last result from the REPL using the :lpy:fn:`pp` convenience |
27 |
| - macro. |
28 |
| - |
29 |
| - As an alternative, the :lpy:fn:`write` API enables a more ergonomic API for |
30 |
| - configuring the printer using keyword arguments rather than dynamic Vars. |
31 |
| - |
32 |
| - .. code-block:: |
33 |
| - |
34 |
| - (pprint/write (ns-interns 'basilisp.pprint) :sort-keys true) |
35 |
| - ;; {*current-length* #'basilisp.pprint/*current-length* |
36 |
| - ;; ... |
37 |
| - ;; write-out #'basilisp.pprint/write-out} |
38 |
| - |
39 |
| - Custom Pretty Print Dispatch Function |
40 |
| - ------------------------------------- |
41 |
| - |
42 |
| - TBD |
43 |
| - |
44 |
| - Unimplemented Features |
45 |
| - ---------------------- |
46 |
| - |
47 |
| - The following features from ``clojure.pprint`` are not currently implemented: |
48 |
| - |
49 |
| - - ``:fill`` newlines |
50 |
| - - ``code-dispatch`` for printing code |
51 |
| - - ``cl-format`` |
52 |
| - |
53 |
| - References |
54 |
| - ---------- |
55 |
| - |
56 |
| - - Tom Faulhaber et al.; ``clojure.pprint`` |
57 |
| - - Oppen, Derek; \"Prettyprinting\"; October 1980 |
58 |
| - - Waters, Richard; \"XP: A Common Lisp Pretty Printing System\"; March 1989" |
59 | 2 | (:require
|
60 | 3 | [basilisp.string :as str]
|
61 | 4 | [basilisp.walk :as walk])
|
|
0 commit comments