Skip to content

Instantly share code, notes, and snippets.

@timsgardner
Created July 28, 2016 20:50
Show Gist options
  • Select an option

  • Save timsgardner/c5fd196a1e240d99823279b4781c350e to your computer and use it in GitHub Desktop.

Select an option

Save timsgardner/c5fd196a1e240d99823279b4781c350e to your computer and use it in GitHub Desktop.
nothing to see here
;; ============================================================
;; embarrassingly, the following totally works
(def result (atom []))
(defn readr [prompt exit-code]
(let [input (clojure.main/repl-read prompt exit-code)]
(if (= input :tl)
exit-code
input)))
(let [input (clojure.string/join "\n"
["(swap! result conj (+ 1 1))"
":tl"])]
(binding [*in* (LineNumberingTextReader.
(SynchronizedReader.
(StringReader. input)))]
(clojure.main/repl
:prompt #(print "debug=> ")
:read readr
:eval eval)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment