Developing clojure with Emacs Cider is great. To be able to view summaries for clojure functions and special forms, type this in you Cider REPL:
Afterwards, you can do stuff like this:
my.repl> (doc conj)
([coll x] [coll x & xs])
conj[oin]. Returns a new collection with the xs
'added'. (conj nil item) returns (item). The 'addition' may
happen at different 'places' depending on the concrete type.
Emacs has a great mode for using Clojure called Cider. Cider comes with an interactive REPL. The REPL allows you to test your code, start web apps, if you are using Luminus, and all in all accelerates development. One annoying thing though is that you have to refresh Cider every time you saved your sources. The good thing is that you can do this automatically. Just add the following to your init.el. I took the function from a blog post by Kris Jenkins:
'(lambda () (add-hook 'after-save-hook
(if (and (boundp 'cider-mode) cider-mode)
(defun cider-namespace-refresh ()
(define-key clojure-mode-map (kbd "C-c C-r") 'cider-namespace-refresh)
Additionally, you can now run the refresh command manually, by hitting C-c C-r.
Update: I changed the after-save-hook to only trigger if we are in a buffer that has cider-mode enabled. Otherwise every save command in Emacs would have triggered the refresh!
I am learning a bit of Clojure from time to time, and today I learned about shorthand notation for anonymous functions:
> (apply (fn [x y] (+ x y)) '(1 1))
Which is equivalent to:
> (apply #(+ %1 %2) '(1 1))