
Clojure Socket Prepl Cookbook - bsg75
https://oli.me.uk/2019-03-22-clojure-socket-prepl-cookbook/
======
bgorman
This is a really useful write up, thanks for putting it together. Pairing
fighweel main with the prepl seems like a very powerful combination. One
feature I use a lot in fireplace.vim is "doc", hopefully you can add that
feature in Conjure soon!

~~~
Olical
Already there :) K will look up docs for the symbol under the cursor. Pretty
sure fireplace has this though...

Example of the doc output:
[https://imgur.com/vSB5Fv5.png](https://imgur.com/vSB5Fv5.png)

------
panzerklein
That Conjure thing definitely looks interesting. I wonder how it handles the
repl - like fireplace or like slimv.

~~~
Olical
Hi, I'm the author and that means a lot to read! It's been a labour of love
going back and forth on rewrites and ideas for about six months so it'll mean
the world to me if it ends up being something people enjoy using some day.

The tool is, like all tools, designed around my preferences and opinions, it
definitely won't align with everyone but I hope there's some good ideas in
there.

There's no traditional REPL, there's a log buffer that has results appended to
it. You can edit that buffer (which happens to be a .cljc file) and evaluate
anything in there like you would in any buffer.

The log buffer appears, expands and hides when required. I've tried to keep it
out of the way when you're not using it but persistent and accessible when you
need it. I definitely want to experiment with Neovim's floating window API and
the "virtual text" API too.

~~~
lenkite
Can you please write a dev-workflow guide (maybe with some GIF's) when you
have the time ? I am a clojure newbie and I can't quite figure out how to
leverage this. I am using lein and vim-fireplace presently, but I always get
the feeling that there is a better dev workflow.

~~~
Olical
Yep, sure thing, good idea. I was going to do an asciinema video or something,
I only got around to writing the README as it stands yesterday, it's the first
time I'm showing it off really.

------
knubie
This tool looks really cool, but I've never heard of a prepl, what is it? How
is it different from a repl?

~~~
Olical
The p in prepl stands for programmable or programs, as in, for programs. If
you open up a socket REPL you can connect to it and send code + receive
results but they're printed without any structure. String goes in and string
comes out.

The prepl wraps all responses in a predictable EDN data structure tools can
consume with ease. This is what Conjure is built on. The source and doc for
the Clojure prepl is really informative:
[https://github.com/clojure/clojure/blob/8e7213781a1a45db9668...](https://github.com/clojure/clojure/blob/8e7213781a1a45db966898835b8f41f545c64d52/src/clj/clojure/core/server.clj#L192-L215)

~~~
knubie
That sounds fantastic. Thanks for the info. Currently I'm using iced-vim, but
I'll definitely have a look at Conjure when I have some time.

