My Lisp setup on Mac OS X
Contents
2 My experiments with vi and REPL
3 Setup Steps
4 Adding Clojure to the mix
1 Could not get a hang of Emacs
When I began lisp programming, I tried using Emacs with Slime. But I could not really use it productively as I expected it to be. I did not find it convenient for editing. Then I learnt vi and never got back to it. (Please do not flame if you are an Emacs lover).
2 My experiments with vi and REPL
For Lisp programming, I have used the REPL plus vi combination successfully. However the following is missing, but in reality it turns out its not such a pain either. I use MacVim and alias vi/vim to mvim so that I can launch mac vim from terminal.
- Ability to complete forms.
Honestly, I think the ability to autocomplete forms gives me a false sense of programming fast. The ability to autocomplete kind of interrupts my thought process. Hence I just use browser documentation lookup, understand the details and then type out the form. Manual autocomplete you may say!
- To look up documentation strings.
Apropos, describe and documentation functions are my friends here.
- To walk through the source code.
Well, what is better than unix find function.
- Formatting lisp code.
I use vim facility to shift block of code.
Suprisingly, debugging was never missed. I use SBCL extensively and I would just do (trace function-name :break t) on REPL and use the debugging facilities detailed here.
For library management, I used clbuild till quicklisp arrived and now I used clbuild2 which underneath uses quicklisp.
ASDF is the build tool for Lisp. For my own system definitions or my own local projects, I now use the quicklisp local projects feature.
3 Setup Steps
Now if you like this setup and want to use, follow these steps.
- Install Macports, the package management system for Mac, following the steps here.
- Now install SBCL with thread support with the following command:
- Install clbuild2, which uses quicklisp underneath.
- Install quicklisp and follow the steps outlined here to start quicklisp when SBCL starts.
- For lisp libraries that are not managed through clbuild or quicklisp, use quicklisp local projects feature.
4 Adding Clojure to the mix
We can use a similar setup to do Clojure programming as well.
- Install clojure , clojure-contrib using Macports
- Install leiningen, which is the build tool for Clojure projects using Macports.
- Create a new clojure project using the following command:
- Now use the following command to start a clojure repl with the fully loaded classpath.
- Now use REPL for interactive clojure programming and vi for editing clojure source code as usual.
In fact with some effort, you can easily program in any language using the simple yet powerful editor vi. With vi, editing is like driving and that boost in productivity for me is much greater than the ’illusion’ of productivity gained from using fancy IDE’s.