Lisp on a Nokia Booklet 3G…

At the office, managed to wheedle a Nokia Booklet 3G, last year’s entry by Nokia into the netbook category. I’ll not review the device here; there are plenty of reviews of the product on the Web. Suffice it to say that the reviews are pretty accurate; it’s a pretty sweet piece of kit hobbled by the choice of Windows Starter and a slow hard disk. Addressing the performance challenges by putting a better operating system on it leads to a very nice subnotebook for light browsing, note taking, and such. Perhaps surprisingly, I actually reach to it before the iPad for some casual computing, especially at the office.

The operating system I chose is Jolicloud; I wanted to see the UI, and it has built-in compatibility for the GMA500 graphics controller in the Nokia Booklet and didn’t want to mess with patching Ubuntu once I got started. Reports were correct—installing Jolicloud was a snap and just works on the Booklet. What follows here should work on any Ubuntu derivative, and more broadly, probably any Debian-based Linux distribution.

So what about Lisp? I don’t get paid to do Lisp programming, but like playing in Lisp; it sharpens my thinking about the algorithms and code I write, and I’m thinking about introducing my son to Lisp through the excellent book Land of Lisp by Conrad Barski (which you can read about here). It’s also been a while since I’ve worked any of the exercises in Peter Seibel’s Practical Common Lisp (see the web site).

Because Jolicloud was running a Debian fork of Linux (Jolicloud’s parent is Ubuntu, derived from Debian), getting a Lisp was as easy as running the APT package manager. I chose CLISP, because I’d not used it before but it’s the Lisp Barski uses in his book. Bring up a command prompt (Alt-F1), and type:

kf6gpe@kf6gpe-jolicloud:~$ sudo apt-get install clisp
kf6gpe@kf6gpe-jolicloud:~$ sudo apt-get install clisp-doc
kf6gpe@kf6gpe-jolicloud:~$ sudo apt-get install clisp-dev
kf6gpe@kf6gpe-jolicloud:~$ sudo apt-get install emacs
kf6gpe@kf6gpe-jolicloud:~$ sudo apt-get install slime

This gets you both CLISP and its documentation for playing, and emacs and slime if you want to do serious stuff. You can now bring up CLISP from the terminal by typing clisp at the shell. To finish the configuration, put something like the following in your .emacs file:

;;; ================================================================
;;; SLIME configuration
;;; Modified from http://lispm.dyndns.org/news?ID=NEWS-2008-08-27-1

(require 'slime-autoloads)
(slime-setup `(slime-asdf slime-fancy slime-tramp))

(setq slime-autodoc-use-multiline-p t)
(setq slime-repl-history-size 1000)
(setq slime-startup-animation t)
(setq slime-default-lisp 'clisp)
(setq slime-truncate-lines nil)
(setq slime-lisp-implementations
     `((clisp   ("/usr/bin/clisp")              :coding-system utf-8-unix)
       ;;(ccl   ("/usr/bin/ccl")                :coding-system utf-8-unix)
       ;;(abcl  ("abcl")                        :coding-system utf-8-unix)
       ;;(cmucl ("/usr/bin/cmucl" "-quiet")     :coding-system iso-latin-1-unix)
       ;;(ecl   ("/usr/local/bin/ecl")          :coding-system iso-latin-1-unix)
       ;;(gcl   ("gcl")                         :coding-system iso-latin-1-unix)
       ;;(sbcl  ("/usr/bin/sbcl")               :coding-system utf-8-unix)
       ))
; do m-- m-x slime ccl to start Clozure Common Lisp from the list above

(global-set-key "\C-cs" 'slime-selector)

(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))

(defmacro defslime-start (name lisp args coding-system)
  `(defun ,name ()
     (interactive)
     (require 'slime)
     (slime-start :program ',lisp :coding-system ',coding-system :program-args ',args)))

(defslime-start clisp   "/usr/local/bin/clisp -K full"  nil         utf-8-unix)

This work is shamelessly borrowed from Rainer Joswig; he shows how to set up SLIME on the Macintosh using Aquaemacs. In our case, we comment out all the other Lisp implementations—although I’d bet if you wanted a different Lisp (say, SBCL), it’s no more than an apt-get away.

Leave a Reply