# Lisp

## Emacs Org-mode and literate programming

I’ve been using Emacs for editing and evaluating R code with ESS for a long time now. I also like Emacs for editing statistical reports and compiling them using knitr (and before that, Sweave), using plain $\LaTeX$ or just RMarkdown. Now, I’m getting interested in org-mode as an alternative to noweb, which I previously used when looking for a way to integrate different programming languages (e.g., sh, sed, and R) into the same document.

## Common Lisp on Mavericks

Here are some notes I took when setting up Emacs to run SBCL on a fresh Macbook Pro powered by Homebrew. I was surprised to find no Info page for sbcl, and after looking for what was installed by Homebrew under /usr/local1, I just found the man page: % ls /usr/local/Cellar/sbcl/1.2.1/share/man/man1 sbcl.1 So I decided to download SBCL from its homepage, http://www.sbcl.org, and compile it myself as I did on my previous Mac.

## Scheme and Emacs

For those who like to write Scheme without leaving Emacs, Geiser is probably the way to go. The Racket guide for Emacs also recommends to install Quack, which I happened to try long ago for an introductory course in programming for Bioinformatics where we were using Scheme (I was using Chicken Scheme at that time). I believe DrRacket (formerly PLT Scheme) is really a great software to learn Scheme and do serious stuff with it, including computational science.

## Time to lush

As part of my investigation on Lisp-based solutions for statistical computing (see also this related post), I am now trying to get a working installation of Lush. I discovered Lush some time ago (two years at least) but only think of trying it more seriously after having reread Ross Ihaka’s famous papers on the need of developing a new statistical programming language (after R). In Back to the Future: Lisp as a Base for a Statistical Computing System, and the accompagnying slides, he argued that he obtained better performance in Lisp with real and artificial datasets, compared to R or Python.

## Diving Into Lisp for Statistical Computing

Well, it may seem like I feel either nostalgic of an era of statistical computing that I didn’t ever know or a little bit crazy to go back to Lisp while R has become lingua franca in statistics, but a wistful smile let me think I have a lot to learn going back to the 90’s and… xlispstat or Lisp Stat. I always have the latest version of xlispstat installed on my Mac.

## Getting started with Slime

Slime provides a complete environment for Lisp development with Emacs. It includes a minor mode that enhances lisp-mode, a common lisp debugger (SLDB), an REPL, and an inspector. It supports several CL implementation, including CMUCL, SBCL, Clozure CL, or CLISP. It comes prepackaged for Aquamacs users, see the Download page on aquamacs.org. Basic usage Start Slime with M-x slime. The first time, a lot of elip files will be compiled on the fly, but the next time it will start much faster.