Welcome! Please see the About page for a little more info on how this works.

+5 votes
in REPL by

I have been nrepl based for a long time and that didn't play nicely with creating "sub repls" with clojure.main/repl. I'm using socket repls now and really enjoying that sub repls are usable again for me. I'm mostly just doing a simple call

(clojure.main/repl
 :prompt (fn [] (printf "%s=> " (peek (str/split (str *ns*) #"\."))))
 :read server/repl-read)

What else are people doing with sub repls? Creating history files of evaluation? Throwing forms into a db? Really interested to know.

2 Answers

0 votes
by

I use it with a fork of NightCode called nightclub to provide an embedded repl + mini IDE + file editor + project manager for an application I deploy. Users basically get a clojure environment + live scripting of the application as well as a GUI that echoes commands to the REPL for sort of an interactive learning experience (kind of like the VBA editor in Excel). I have benefited from this in restricted environments where all I was allowed was an uberjar; with this setup I get a nice little clojure dev environment / scripting / debug setup in addition to the application.

0 votes
by

I use it to use fipp as my default printer, which is noticeably faster than clojure's default print/pprint

(clojure.main/repl
  :caught (fn [e] (fipp.repl/pst e))
  :print  (fn [x] (fipp.edn/pprint x)))
...