Managing Scheme libraries

January 18, 2024

A quick note on the packaging system for some of the Scheme implementations I use. It is rather incomplete at this point, I will eventually update it later.

Recently I’ve been looking at Chez Scheme documentation and various places on the intertubes to learn how to create or manage Scheme libraries. I’m used to Racket and Chicken, which both ship with a great package manager, something that is currently lacking in some of Scheme distros, especially Chez Scheme. Unlike Quicklisp, you don’t end up with every version of a single package once you update your package list, although I understand why it may be interesting to keep a copy of older packages, especially when they are linked to a working repository.

With Chicken, we usually add repositories to the exported variable CHICKEN_REPOSITORY_PATH. We can also check where system-wide is installed with chicken-install -repository. User-compiled modules usually go under $HOME/.cache/chicken-install, but I always install modules as root. Be sure to check the man page for chicken-install in any case. Racket has its own conventions to manage modules (see also Beautiful Racket); likewise, there are well-defined steps to create your own package and make it available from Racket REPL or programs. There are some package templates for Racket, but see Tutorial: Creating a Package.

As regards Chez Scheme, it seems that the best way to define a local repository for your package is via an exported variable:

[ -d "$HOME/.local/lib/scheme" ] && export CHEZSCHEMELIBDIRS="/home/chl/.local/lib/scheme:"

We can check that everything is all right as follows:

» chezscheme
Chez Scheme Version 9.5.4
Copyright 1984-2020 Cisco Systems, Inc.

> (library-directories)
  ("." . ".")
  ("/usr/share/r6rs" . "/usr/share/r6rs"))

I also heard of Akku, after reading one of Travis Hinkelman’s posts, I even installed on my HD but I never used it.

♪ Joy Divsion • A Means to an End

See Also

» Permutation test in Lisp » Currying and repeated calls of a function » Bootstrap resampling using Scheme » Algorithms for functional programming » Summing random Uniform deviates