Clojure is a trinity of language, REPL, and structural editor
blog.jakubholy.net
blog.jakubholy.net
That being said, the setup cost is paid pretty quickly. Developers underestimate how much time they waste reloading stuff into place. Updated a function - woops, have to clear the variables I setup and run intermediate steps all over again. Even if you think 'yeah but I just write tests and those run the whole flow' using a REPL is worth it. I work with Rails, use guard and try to keep tests fast by sticking to POROs and still does not beat the interactivity of the REPL.
One workflow that comes close is working with Elm's compiler. Super friendly and interactive; gives you a similar iterative flow as a REPL but in a different context.
I may well try again.
This is a key piece of the REPL workflow: you rarely type into the REPL, you use commands in your editor to select code and run it in a REPL. The idea is that you eval stuff in the same place you type, and that gets run in the same environment over and over again without having to restart it or redefine the data you're using to iterate your functions.
It's for neovim, but is using very modern tools and even uses a clojure like lisp to configure the setup.
I've never had the opportunity to use Clojure in production projects but, as an exercise in learning the langue, I did a library that I've had to rewrite for many production systems (can't copy paste across companies), in various languages, over the past 15 years, and I liked the end result of the Clojure version way more than any other. It was objectively shorter and easier to reason about. Even the insane, invalid XML parsing that has to be done to integrate with a third-party interface. Just hope I get to use it, in a pragmatic sense, someday.
Here is my common lisp setup easily adaptable to clojure: https://blog.djha.skin/p/developing-common-lisp-using-gnu-sc...
My thoughts on emacs versus vim and a better approach to trying to get them to be useful for things like common Lisp and Clojure: https://blog.djha.skin/p/emacs-users-im-okay-i-promise/
The main idea is that you don't need an IDE. Most Ides just copy and paste stuff for you into the repl, believing that you're too stupid to learn the commands inside the repl yourself and so they'll do it for you and you'll just learn a bunch of hotkeys. As if learning the hotkeys was easier than just learning the commands. I don't mean to offend anybody but this never made sense to me. Just learn the commands, then you can use the commands from whatever editor you want without having to relearn a bunch of hotkeys switching from emacs to vs code.
Being a VIM person, I imagine you're pretty comfortable in the terminal and so will not have a problem just using the repl in one window with vim in the other. Then I just have a few plugins to make it easier to copy and paste between vim and the repl.
I will say this, getting an LSP client for Clojure does help, but between that and syntax highlighting I'd say you're good to go.
https://github.com/djtango/spartan-repl
I tidied it up a little for my personal .vimrc but it works surprisingly well for how little effort it took to configure. One known issue is if the thread of execution spawns a sub thread then exits (because the ncat socket is closed)
I was surprised just how lightweight a REPL editor integration could be - simply having a Vim editing experience over a REPL is pretty incredible
I now use clojure + neovim thanks to: https://github.com/Olical/conjure
Dead simple to set up and to use!
Another one is Ruby + Pry. It's magical.
Honestly, I never really tried, and it's been quite a while since I last touched ruby. Being able to interact with a live system at a breakpoint was amazing enough to me at the time. The REPL was pretty nice from what I recall - much friendlier than irb or the builtin python one.
Interactive development has a decent established history of lowering the bar to entry to computing.
Less familiar with Python, but my impression was that Jupyter notebooks weren't so great for nudging you towards better software engineering practices (when compared to the clojure REPL)?
When developing something closer to a program, I usually write code line by line in a text editor, but basically every line has been developed in the IPython REPL.
Sometimes I write a few cells in Jupyter Notebook to learn an API. It is really nice that you can have the output of a call in cell 1 while working on refining that call in cell 2.
Once I feel I've learned what is needed, I move the code into a .py file and turn it into a script or a module.
Despite of this workflow, I haven't found a great pairing between editor and IPython REPL and I am manually copy-pasting code between the two.
RStudio works really well in this regard, but I think that the editor runs on the same R kernel instance as the program you are developing, which makes restarting R a pain.
The canonical Clojure setup would have you start a REPL when you begin your coding session (or more, could be weeks/months without a restart), edit your source files and use keybindings to evaluate text in block comments.
This basic setup can go with addons like Calva (VSCode; can inline the results, like a notebook and has other features) and Portal (can render data structures in different viz formats).
For Jupyter: - Does your source have to mimic some sort of literate programming style to keep a certain format expected by the notebook? - If you edit other notebooks, do the cells in your current notebook get updated? - Can the notebook be connected to a production environment to run code using live production data?
The 'structural editing' makes it integrate so well with the REPL. I'm not sure how Jupyter notebooks work, but in clojure every line of code you write is immediately accessible via the REPL. It would be as if python was built with the assumption that every .py file was a Jupyter notebook.
Navigating a file and want to see what some expression is? One keybinding.
Can't remember exactly how a function works and want to test it? One keybinding.
Changed some code and want to make sure the tests pass? One keybinding.
Curious what result a function will return? Well add some test code anywhere, then you guessed it, one keybinding.
I'm using Calva + vscode and the onboarding seemed pretty simple. Installed Babashka using linuxbrew, then installed Calva in VScode and ran its tutorial. Calva has a pretty good guide on the structural code editing: https://calva.io/paredit/
Now I "just" need to figure out how to parse xml. Zippers melt my brain
I have moved to Common Lisp and it is much simpler and saner, while having the same REPL driven development.
(It would be nice to tinker.)
Is great for vs code but emacs and slime works of course.
The REPL is way too complicated as a selling point, but it's THE concept I took from Clojure and ported it to my workflow in other languages. It has made me appreciate Hot Reloading in front end apps (and make sure it always works perfectly), make my Ruby console reload friendly, organize my React apps so business logic stays in models I can use in a REPL.