Skip to content

Instantly share code, notes, and snippets.

@JacobNinja
Created September 10, 2015 17:36
Show Gist options
  • Save JacobNinja/0c797b84904d8bde831f to your computer and use it in GitHub Desktop.
Save JacobNinja/0c797b84904d8bde831f to your computer and use it in GitHub Desktop.
Pretty print last repl return value
user=> (macroexpand-1 '(async/go (inc 1)))
(clojure.core/let [c__12900__auto__ (clojure.core.async/chan 1) captured-bindings__12901__auto__ (clojure.lang.Var/getThreadBindingFrame)] (clojure.core.async.impl.dispatch/run (clojure.core/fn [] (clojure.core/let [f__12902__auto__ (clojure.core/fn state-machine__12729__auto__ ([] (clojure.core.async.impl.ioc-macros/aset-all! (java.util.concurrent.atomic.AtomicReferenceArray. 7) 0 state-machine__12729__auto__ 1 1)) ([state_7171] (clojure.core/let [old-frame__12730__auto__ (clojure.lang.Var/getThreadBindingFrame) ret-value__12731__auto__ (try (clojure.lang.Var/resetThreadBindingFrame (clojure.core.async.impl.ioc-macros/aget-object state_7171 3)) (clojure.core/loop [] (clojure.core/let [result__12732__auto__ (clojure.core/case (clojure.core/int (clojure.core.async.impl.ioc-macros/aget-object state_7171 1)) 1 (clojure.core/let [inst_7169 (do (inc 1))] (clojure.core.async.impl.ioc-macros/return-chan state_7171 inst_7169)))] (if (clojure.core/identical? result__12732__auto__ :recur) (recur) result__12732__auto__))) (catch java.lang.Throwable ex__12733__auto__ (clojure.core.async.impl.ioc-macros/aset-all! state_7171 clojure.core.async.impl.ioc-macros/CURRENT-EXCEPTION ex__12733__auto__) (clojure.core.async.impl.ioc-macros/process-exception state_7171) :recur) (finally (clojure.lang.Var/resetThreadBindingFrame old-frame__12730__auto__)))] (if (clojure.core/identical? ret-value__12731__auto__ :recur) (recur state_7171) ret-value__12731__auto__)))) state__12903__auto__ (clojure.core/-> (f__12902__auto__) (clojure.core.async.impl.ioc-macros/aset-all! clojure.core.async.impl.ioc-macros/USER-START-IDX c__12900__auto__ clojure.core.async.impl.ioc-macros/BINDINGS-IDX captured-bindings__12901__auto__))] (clojure.core.async.impl.ioc-macros/run-state-machine-wrapped state__12903__auto__)))) c__12900__auto__)
user=> (pp)
(clojure.core/let
[c__12900__auto__
(clojure.core.async/chan 1)
captured-bindings__12901__auto__
(clojure.lang.Var/getThreadBindingFrame)]
(clojure.core.async.impl.dispatch/run
(clojure.core/fn
[]
(clojure.core/let
[f__12902__auto__
(clojure.core/fn
state-machine__12729__auto__
([]
(clojure.core.async.impl.ioc-macros/aset-all!
(java.util.concurrent.atomic.AtomicReferenceArray. 7)
0
state-machine__12729__auto__
1
1))
([state_7171]
(clojure.core/let
[old-frame__12730__auto__
(clojure.lang.Var/getThreadBindingFrame)
ret-value__12731__auto__
(try
(clojure.lang.Var/resetThreadBindingFrame
(clojure.core.async.impl.ioc-macros/aget-object
state_7171
3))
(clojure.core/loop
[]
(clojure.core/let
[result__12732__auto__
(clojure.core/case
(clojure.core/int
(clojure.core.async.impl.ioc-macros/aget-object
state_7171
1))
1
(clojure.core/let
[inst_7169 (do (inc 1))]
(clojure.core.async.impl.ioc-macros/return-chan
state_7171
inst_7169)))]
(if
(clojure.core/identical? result__12732__auto__ :recur)
(recur)
result__12732__auto__)))
(catch
java.lang.Throwable
ex__12733__auto__
(clojure.core.async.impl.ioc-macros/aset-all!
state_7171
clojure.core.async.impl.ioc-macros/CURRENT-EXCEPTION
ex__12733__auto__)
(clojure.core.async.impl.ioc-macros/process-exception
state_7171)
:recur)
(finally
(clojure.lang.Var/resetThreadBindingFrame
old-frame__12730__auto__)))]
(if
(clojure.core/identical? ret-value__12731__auto__ :recur)
(recur state_7171)
ret-value__12731__auto__))))
state__12903__auto__
(clojure.core/->
(f__12902__auto__)
(clojure.core.async.impl.ioc-macros/aset-all!
clojure.core.async.impl.ioc-macros/USER-START-IDX
c__12900__auto__
clojure.core.async.impl.ioc-macros/BINDINGS-IDX
captured-bindings__12901__auto__))]
(clojure.core.async.impl.ioc-macros/run-state-machine-wrapped
state__12903__auto__))))
c__12900__auto__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment