Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

April 2007
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Mar  May

Lisp with Batteries Included

Tuesday, April 3, 2007

I often used to get emails from new Lisp users asking about the best way to get started developing with Common Lisp. I guess this was because, a few years ago, I created a page for the Common Lisp Cookbook called Setting up an IDE with Emacs on Windows or Mac OS X that a lot of people found useful. However, that page is now pretty much obsolete as I haven't maintained it for a number of years and the tool recommendations on the page are at least partly defunct (ILISP has been pretty much replaced by SLIME now). In recent years, if people asked for my advice, I have recommended one of the following:

However, once someone has gotten past some of the initial Lisp learning curve, they still have to come to grips with the different 3rd party libraries that are available. Python has long had a philosophy of "batteries included", providing a rich and versatile standard library which is immediately available, without making the user download separate packages. This gives the Python user a head start in many projects as he doesn't have to write a lot of the "infrastructure" when creating a new application. Using ASDF to load new packages in CL is not hard; however, it seems to regularly "trip up" new CL users. So, I was intrigued when I saw that Edi Weitz had created a new utility called STARTER-PACK that provides an easy mechanism for quickly downloading/installing a lot of the more commonly used CL libraries (along with all their dependencies). In addition, he provides detailed installation instructions, getting started tips, usage examples, a mechanism for adding additional libraries (in the event that you want to create a custom set of packages that newbies can easily use) and a basic blueprint for creating your own libraries. It only runs on Windows (yuck, petuwee) at the moment, but I recently was able to try it out on a Windows box and was really impressed by how easy it was to get a productive CL development environment setup. I made a few tweaks to Edi's code and got it to run on my Mac as well:

Starter Pack

I'll see if Edi wants to include the patches in his code; however, he may not want to maintain non-Windows binary distributions. So, if anyone else is interested in the Mac changes, let me know.

If you're using Edi's Starter Pack on Windows with LispWorks Personal Edition, you may find the following WSH script useful to start up LispWorks and load the initial start.lisp code (the LispWorks Personal version doesn't have support for init files):
Dim Wsh
Set Wsh = Wscript.CreateObject("Wscript.Shell")
Set Net = WScript.CreateObject("WScript.Network")
rem Start up LispWorks Wsh.Run("C:\PROGRA~1\LISPWO~1\LISPWO~1.EXE")
rem Wait for a few seconds for it to start WScript.Sleep(5000)
rem Press the OK button on the splash screen Wsh.AppActivate "Upgrade LispWorks" Wsh.SendKeys "{ENTER}"
rem Load the startup code Wsh.AppActivate "LispWorks Personal Edition 5.0.1" username = Net.UserName str = "(load " & """C:/Documents\ and\ Settings/" & username & "/My\ Documents/Lisp\ Libraries/start.lisp"")" WScript.Sleep(100) Wsh.SendKeys (str) Wsh.SendKeys "{ENTER}" WScript.Sleep(100)
The script should work without any modifications so long as you followed Edi's installation instructions and didn't change any of the directory locations.

The equivalent AppleScript script for Mac OS X is here:
do shell script "open -a \"LispWorks Personal\""
do shell script "sleep 8"
tell application "LispWorks Personal" activate tell application "System Events" tell process "LispWorks Personal" repeat until get frontmost end repeat -- The following should close the splash window but it doesn't work!! (manually close it for now) -- tell window "LispWorks Personal Edition" -- click button "Close" -- end tell tell window "Listener 1" keystroke "(when (probe-file \"~/Documents/Lisp-Libraries/start.lisp\") (load \"~/Documents/Lisp-Libraries/start.lisp\"))" keystroke return end tell end tell end tell end tell
This script assumes that the libraries are installed in "~/Documents/Lisp-Libraries" (this may change if Edi decides to include support for Mac OS X and doesn't use the same location as I did). Incidentally, you'll notice in the AppleScript above that the lines that close the LispWorks splash window are commented out. This used to work on previous versions of LispWorks but doesn't work on version 5. If anyone knows the correct incantation to use, I'd appreciate knowing (I'll update this post if I get an answer)! In the meantime, you'll need to manually close the LispWorks splash window.

Update-2007-04-04: Wow, that was quick - Edi has already applied my Mac OS X patches to his STARTER-PACK library and there is a new 0.4.5 release available! Edi has no current plans to provide a Mac OS X binary of STARTER-PACK; however, anyone who has a Mac and who wants to build the software can now do so (you will need the Apple Develoment Tools in order to build some things - for example, the UFFI parts of CLSQL). Since Macs come with SQLite3 already, it isn't necessary to download a copy of SQLite if you want to try out CLSQL. Thanks again Edi for writing STARTER-PACK and for providing such excellent libraries for the CL community!

emacs Copyright © 2007 by Bill Clementson