Re:Clojure Cookbook is now accepting contributions
by tbatterii on Wednesday June 12, 2013 @05:03PM
(#5870722)
I wish I could upvote you more. I've been playing with clojure for weeks and I use nrepl, but it never clicked what a solid workflow could be.
Re:Clojure Cookbook is now accepting contributions
by michaelochurch on Wednesday June 12, 2013 @09:06PM
(#5871733)
This deserves more upvotes than the 1 that I can give it.
This is how I start Emacs:
And this is my workflow once I have source file and nrepl split-panes open: I actually rarely use the repl window since you can eval code in the source file.* I pretty much treat my source file as my repl and use `c-x c-e` to execute the previous form. (Screenshot: http://dl.dropbox.com/u/51836583/Screenshots/l0.png)
* Also, I'll often put the code I'm trying to get to work like `(my-func 1 2 3)` at the bottom of my source file. Then, while I'm hacking on `my-func`'s implementation, I mash `c-c c-k` (eval buffer) which returns the result of the last expression in the file.
* Another nice way to utilize `c-c c-k` is to put your `(assert (= (my-func 1 2 3) 42))` tests right into the source file. The tests will get run every time you eval the buffer. It's a solid test-driven loop baked into the core library!
(See more nrepl keymappings here: https://github.com/kingtim/nrepl.el#keyboard-shortcuts)