July 9th, 2008

lisp

Tilde for SBCL convenience

Every now and then I want to use leading tildes in SBCL pathnames. That is, something like this:

(probe-file "~/.emacs") =>
   #P"/home/xach/.emacs" 
OR #P"/Users/xach/.emacs"
OR #P"/usr/u/xach/.emacs"

I know about user-homedir-pathname, but it's not quite convenient for interactive REPL use.

So I put together a short file that patches SBCL internals slightly so leading tildes in pathnames go through the POSIX getpw interface to look up home directories. It's not something I'll ever use in source files, but it's pretty convenient interactively.

To use it yourself, just download tilde.lisp and add this to your ~/.sbclrc:

(load "/path/to/tilde.lisp")
(tilde:install-tilde-expander)

After that, you can use "~/foo" and "~bob/foo" in SBCL pathnames.

update Here's a git repo for tilde.lisp, with an ASDF system file too.

New Salza2 and ZPNG

I released new versions of Salza2 and ZPNG today.

The Salza2 updates are minor tweaks the defsystem to fix build problems on a few Lisps. Thanks to Chaitanya Gupta for bringing it to my attention. Get the new Salza2 here.

ZPNG changes are more extensive. I added COPY-PNG and PNG= functions from Tobias C. Rittweiler (thanks, tcr!). I also added a new class and protocol for writing out PNG files incrementally, row-by-row, so you don't have to create or convert all your image data to a big ZPNG array to write it out to a file. Doing it row-by-row will save memory. In theory you could create a PNG with overall image data much too big to fit in memory, as long as you can fit a single row. Get the new ZPNG here.

If you're into git, you can check out both projects from git.xach.com.

Enjoy!