Skip to content

Instantly share code, notes, and snippets.

@cgrand
Created November 22, 2017 14:16
Show Gist options
  • Save cgrand/fd67ff7459b1a446a14a533095261c14 to your computer and use it in GitHub Desktop.
Save cgrand/fd67ff7459b1a446a14a533095261c14 to your computer and use it in GitHub Desktop.
Experiment in compact pretty printing
=> (doseq [w (range 32)]
(prn 'width w)
(render (best-layout (spans '(1 2 3 4 (a b c) 5 6)) w))
(newline))
width 0
width 1
width 2
width 3
width 4
(1 2
3 4
(a
b
c)
5
6)
width 5
(1 2
3 4
(a b
c)
5 6)
width 6
(1 2
3 4
(a b
c)
5 6)
width 7
(1 2 3
4 (a b
c)
5 6)
width 8
(1 2 3 4
(a b c)
5 6)
width 9
(1 2 3 4
(a b c)
5 6)
width 10
(1 2 3 4
(a b c)
5 6)
width 11
(1 2 3 4
(a b c)
5 6)
width 12
(1 2 3 4
(a b c)
5 6)
width 13
(1 2 3 4
(a b c) 5 6)
width 14
(1 2 3 4
(a b c) 5 6)
width 15
(1 2 3 4
(a b c) 5 6)
width 16
(1 2 3 4
(a b c) 5 6)
width 17
(1 2 3 4
(a b c) 5 6)
width 18
(1 2 3 4
(a b c) 5 6)
width 19
(1 2 3 4
(a b c) 5 6)
width 20
(1 2 3 4
(a b c) 5 6)
width 21
(1 2 3 4 (a b c) 5 6)
width 22
(1 2 3 4 (a b c) 5 6)
width 23
(1 2 3 4 (a b c) 5 6)
width 24
(1 2 3 4 (a b c) 5 6)
width 25
(1 2 3 4 (a b c) 5 6)
width 26
(1 2 3 4 (a b c) 5 6)
width 27
(1 2 3 4 (a b c) 5 6)
width 28
(1 2 3 4 (a b c) 5 6)
width 29
(1 2 3 4 (a b c) 5 6)
width 30
(1 2 3 4 (a b c) 5 6)
width 31
(1 2 3 4 (a b c) 5 6)
@cgrand
Copy link
Author

cgrand commented Nov 23, 2017

@kkinnear, thanks I wasn't aware of zprint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment