Arc on Windows for Web Apps

Paul Graham is one of the two bloggers whose posts I read regularly – an eccentric venture capitalist, successful entrepreneur, hacker, and painter.

Paul’s been working a new language called Arc for a long time, claiming it will be a powerful variant of Lisp suitable for web applications – this surely has nothing to do with one of his companies, Reddit, rewriting their app in Python when they found Lisp didn’t have scalable HTTP libraries. After running his news site on Arc for a long time as a sort of soak test, he’s finally released an alpha version.

Since it’s always a good idea to try new languages (and I have a personal web-application itch to scratch), I thought I’d try Arc on my long commute. But since Paul runs Unix and I run Windows, I had a few challenges. To help others who might want to try it, here’s what I did to run Arc on Windows, including steps to execute a simple web application from within it.

(N.B.: Some steps, particularly Cygwin and copying the [mzscheme]\collects folder, might not be necessary – I didn’t test for a minimal installation method.)

1. Visit Click [other versions] and get version 352.
2. Run the installer. By default, it will install MzScheme in C:\Program Files\MzScheme, but put it anywhere you like. We’ll refer to the installation folder as [mzscheme] hereafter.
3. Run [mzscheme]\Setup PLT.exe.
4. In the output, look for the line
setup-plt: C:\[some-directories]\Application Data\PLT Scheme\352\collects
This folder didn’t exist for me; I created it and copied [mzscheme]\collects\* to it.

1. Visit and follow instructions to install Cygwin. By default, it will install in C:\Cygwin; we’ll call the install directory [cygwin].

1. Visit and follow instructions to install OpenSSL. By default, it’s installed in C:\OpenSSL; we’ll call the install directory [openssl].

1. Add [mzscheme];[openssl]\bin;[cygwin]\bin to your Windows PATH environment variable. (Click [Start], then right-click My Computer and click Properties, then click Advanced, then click Environment Variables, then choose Path and click [Edit]. We love Bill!)
2. To verify this worked, type these commands in a DOS prompt – you should get sensible output from each:
mzscheme -v
openssl version
cygcheck -V

1. Create arc directory in a convenient place, hereafter [arc].
2. Visit and save the file in [arc].
3. Untar the file (use 7Zip if you don’t already have it). You now have a folder [arc]\arc0, hereafter [arc0].
4. Create folders C:\tmp, [arc0]\arc, [arc0]\arc\posts, and [arc0]\arc\logs.
5. Create batch file [arc0]\arc.bat:

@echo off
mzscheme.exe -m -d as.scm

Run Arc
1. Double-click [arc0]\arc.bat.
2. Type "hello world"
3. Type (defop hello req (pr "hello world")), then (asv).
4. Visit http://localhost:8080/hello. You should get an exciting web page. (Strangely, it always seems to hang on first visit for me. But subsequent visits work fine.)
5. Type Ctrl-C to stop the server, then double-click [arc0]\arc.bat again. (There may be a cleaner way to halt an Arc webserver, but I haven’t found it yet.)
6. Type (load "blog.arc"), then (bsv).
7. Visit http://localhost:8080/blog to start using the blog.

Thanks to these posts from which the instructions above are drawn: