In my scant free time, I have begun playing with Common Lisp again. It’s been 10-15 years since I last spent any time with it. I recently discovered a program called Opusmodus that uses Common Lisp at its core. It provides a music composition interface using Common Lisp to enable composers to programmatically score their compositions.
Opusmodus wasn’t explicitly designed for programmers though there are a number of programmers that use it from what I can tell. If you have written any Common Lisp in recent history, QuickLisp is a natural tool to use as part of the development cycle. Unfortunately, Opusmodus’s bundled version of Clozure CL (called
ccl later) is stripped of the development interfaces so some packages will not compile correctly with
If you go hunting around for instructions on how to install QuickLisp properly with Opusmodus, there’s a few references on the forums but they’re at least a couple years old. Here’s a quick set of steps to get QuickLisp installed and loaded automatically. It’s broken into updating
ccl and then what changes are necessary in Opusmodus.
Note: Update any instances of
<user> with your own user’s name.
- Pick a directory where you’d like to have the full
cclinstalled. A good place would be
- Fetch the sources from git:
git clone https://github.com/Clozure/ccl.git /Users/<user>/ccl
- Fetch the bootstrapping binaries:
curl -L -O https://github.com/Clozure/ccl/releases/download/v1.12-dev.5/darwinx86.tar.gz
– Note: At the time that I wrote this, Opusmodus was using
ccl v1.12-dev.5which is why the bootstrapping binaries above reference that specific release.
- Change directory into the
- Unpack the bootstrapping binaries into the sources directory:
tar xf ../darwinx86.tar.gz
- Now rebuild
(rebuild-ccl :full t)
If all went well, you should see a lot of output about “Loading …” and then at the end:
;Wrote bootstrapping image: #P"/Users/zbrown/Code/lisp/ccl-dev/x86-boot64.image" ;Building lisp-kernel ... ;Kernel built successfully. ;Wrote heap image: #P"/Users/zbrown/Code/lisp/ccl-dev/dx86cl64.image"
Configuring Opusmodus to Load QuickLisp
The default location for Opusmodus to install extensions is in
/Users/<user>/Opusmodus/Extensions. Opusmodus v1.3 includes a
QuickLisp Start.lisp in the extension directory with a lot of what you need to get started.
There’s a couple of specific things you need to update though to get it working:
- First, the entirety of the
QuickLisp Start.lispis block/multiline commented out. If you’re not familiar with the Common Lisp multilane comments, they open with
#|and close with
|#. In my installation of Opusmodus, the entire file was commented out.
- Second, you need to tell Opusmodus to use your own version of
cclinstead of the bundled version of
ccl. Beneath the line
(in-package :Opusmodus), add this line (update the
(setf (logical-pathname-translations "ccl") '((#P"ccl:**;*.*" #P"/Users/<user>/ccl/**/*.*")))
– This updates the path that Opusmodus looks for
- Next we need to uncomment the lines that load QuickLisp and install it. They look like the following:
Once you’ve finished up the two sections above, you can launch Opusmodus and it should load QuickLisp. To test this, select the Listener window and install a package:
(ql:quickload "cl-json"). If all goes well, you should see something like:
Welcome to Opusmodus Version 1.3 (r24952) Copyright © MMXIX Opusmodus™ Ltd. All rights reserved. ? (ql:quickload "cl-json") To load "cl-json": Load 1 ASDF system: cl-json ; Loading "cl-json" ("cl-json") ?
In my case, I already had
cl-json installed so nothing was downloaded.
That’s it. Nothing else to describe.