mirror of
https://github.com/jbranchaud/til
synced 2026-01-17 22:18:01 +00:00
Add Pretty Print The Last Thing as a clojure til.
This commit is contained in:
@@ -31,6 +31,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
- [Evaluate One Liners With lein-exec](clojure/evaluate-one-liners-with-lein-exec.md)
|
- [Evaluate One Liners With lein-exec](clojure/evaluate-one-liners-with-lein-exec.md)
|
||||||
- [Expanding Macros](clojure/expanding-macros.md)
|
- [Expanding Macros](clojure/expanding-macros.md)
|
||||||
- [Open JavaDocs](clojure/open-javadocs.md)
|
- [Open JavaDocs](clojure/open-javadocs.md)
|
||||||
|
- [Pretty Print The Last Thing](clojure/pretty-print-the-last-thing.md)
|
||||||
- [Quick Clojure Docs](clojure/quick-clojure-docs.md)
|
- [Quick Clojure Docs](clojure/quick-clojure-docs.md)
|
||||||
- [Reductions](clojure/reductions.md)
|
- [Reductions](clojure/reductions.md)
|
||||||
- [Set Max Heap Size](clojure/set-max-heap-size.md)
|
- [Set Max Heap Size](clojure/set-max-heap-size.md)
|
||||||
|
|||||||
17
clojure/pretty-print-the-last-thing.md
Normal file
17
clojure/pretty-print-the-last-thing.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Pretty Print The Last Thing
|
||||||
|
|
||||||
|
Clojure provides `pp` as a convenience macro for pretty printing the last
|
||||||
|
thing that was output. If you are playing around with a function in the
|
||||||
|
repl, trying to get the output just right, `pp` can come in handy.
|
||||||
|
|
||||||
|
```clojure
|
||||||
|
> (fancy-func)
|
||||||
|
{:one {:a 1, :b 2, :c 3, :d 4}, :two {:b 2, :c 3, :d 4, :e 5}, :three {:c 3,
|
||||||
|
:d 4, :e 5, :f 6}, :four {:d 4, :e 5, :f 6, :g 7}}
|
||||||
|
> (clojure.pprint/pp)
|
||||||
|
{:one {:a 1, :b 2, :c 3, :d 4},
|
||||||
|
:two {:b 2, :c 3, :d 4, :e 5},
|
||||||
|
:three {:c 3, :d 4, :e 5, :f 6},
|
||||||
|
:four {:d 4, :e 5, :f 6, :g 7}}
|
||||||
|
nil
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user