(defmacro debug-repl
"Starts a REPL with the local bindings available."
([]
'(debug-repl nil))
([form]
`(let [counter# (inc-counter)
eval-fn# (partial eval-with-locals (local-bindings))]
(try
(binding [level (inc level)]
(clojure.main/repl
:prompt #(print (str "dr-" level "-" counter# " => "))
:eval eval-fn#
:read dr-read
:caught caught))
(catch Exception e#
(if (= e# quit-dr-exception)
(if-let [new-form# (.nextElement quit-dr-exception)]
(eval-fn# new-form#)
(eval-fn# ~form))
(throw e#)))))))
Used in 0 other vars
Comments top
No comments for debug-repl. Log in to add a comment.