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.)

MzScheme
1. Visit http://download.plt-scheme.org/mzscheme/. 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.

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

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

Path
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

Arc
1. Create arc directory in a convenient place, hereafter [arc].
2. Visit http://ycombinator.com/arc/arc0.tar 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:
http://lispsamik.blogspot.com/2008/01/arc-in-windows.html
http://arclanguage.org/item?id=160
http://arclanguage.org/item?id=190

7 thoughts on “Arc on Windows for Web Apps”

  1. Followed you here from pg’s site.

    Now, I’m not a programmer. I used to be (kinda) but fell in with odd company and became a sysadmin.

    It’s that easy to stand up a site in arc? I keep reading that ‘less is more’ but .. that’s interesting.

  2. Yes, it is really easy to do. Creating a page is also really simple, if you don’t mind arc’s default formatting. I’ll post about that soon.

  3. Hi I am getting this error and would appreciate any insight into what i am doing wrong

    arc> (defop hello req (pr “hello world”))
    #procedure:gs1430
    arc> (asv)
    The syntax of the command is incorrect.
    The syntax of the command is incorrect.
    Error: “open-output-file: cannot open output file: “C:/tmp/shashLMYR8sPt1i” (T
    he system cannot find the path specified.; errno=3)”

  4. Ok I got everything working but I had to make two minor changes to your directions.

    First I needed to add the c:tmp directory and then under my Arc0 directory a directory called arc.

  5. Thanks robisen! I updated the post to include C:tmp (forgot I’d added that one). [arc0]arc is already described I think in step 4 of the Arc section.

Leave a Reply

Your email address will not be published. Required fields are marked *