2019-10-06: ASDF Packages in Lisp

I'm trying to create a simple set of libraries in Lisp. I need the setup to work for some colleagues who are less familiar with Lisp and not using Linux. Also, it must work across different Lisp implementations: at least SBCL and Lispworks.

Quicklisp is attractive, but I want more of a "copy this folder HERE" approach.

ASDF is the standard way to manage packages in Lisp. The problem is how to find the ASDF files.

Finding ASDF Files

There is no option to load an ASDF file directly. You have to place the files in a known location.

The simplest solution is to use the standard location: place the libraries in the folder "common-lisp" in your home folder (on Windows this is "~/AppData/Local").

To have some control over the location, you can also, from the ASDF documentation, specify a location (on Linux) by creating the file ".config/common-lisp/source-registry.conf.d/asdf.conf" containing a line: +(:tree "PATHNAME")+

Using ASDF

You can now create a folder under PATHNAME for each library you want to use. The .asd system definition within that folder will be found using ASDF.

Remember to require ASDF before you try to load the packages. For example, to use Larry Hunter's statistics package in SBCL:

> (require 'asdf)
> (require 'lhstats)
> (statistics:mean '(1 2 3 4))
5/2

(Note that the package name may not be the same as the one you "require"!)

Also, like LispWorks, your lisp system may force you to write "asdf:load-system" instead of "require" to load the library.


Page from Peter's Scrapbook, output from a VimWiki on 2024-01-29.