4 ms·
The way I do it with Clojure, you never really write any code in REPL prompt directly. You write it in your source code file, then send a piece of code to the R
by nlitened 6y ago
The way I do it with Clojure, you never really write any code in REPL prompt directly. You write it in your source code file, then send a piece of code to the REPL to update the “in-memory” state of your running program.
So any modifications you make stay in your files, just like you would normally do with any other language. But you write your program while it’s running, and you grow/change it piece-by-piece, until it’s done (by that time, your source code is exactly your finished program).
If you want to re-start your REPL session, you just run your current file in the REPL as a whole, and maybe run some “Rich comments” (from the same file) to set up a limited test environment (to isolate the piece of program you’re working on).
This way, you make use of syntax highlighting and all the IDE features.
Edit:
I’ve re-read your example with breakloop — I don’t really have experience with this style of REPLing. I agree that it raises a lot of questions, but thankfully functional nature of Clojure discourages this kind of programming.