This is a collection of blog entries written while learning Lisp. It is posted in the order written so you probably want to jump to the first post.

Sunday, December 2, 2007

Lisp on the web server (my intro to it)

So three weeks ago I was looking to relax one evening and popped in Final Fantasy X into my PS2... Two weeks later the addiction has worn down enough for me to get back to my other spare time projects. Excellent game. :)

One of the things that I want to do with Lisp is use it for making web applications. Six years ago I picked up a PHP book sitting on a friends desk and sense that have written too much PHP for me to feel comfortable. I knew it was vial and evil*, but it was just too easy to whip something up in five minutes that got the job done and the web wasn't where I spent most of my time. About a year ago I personally decided to attempt to not do any more PHP code on my personal projects if possible. So the past two weeks I have messed around with how to use Lisp to generate web pages. I started by just making a script that is run in cgi-bin and clisp which was pretty cool all by itself I must say. Then I found cl-who which is a very nice package. From that I have learned a little bit about asdf (still need to learn much more). Lastly I discovered kpax. KPax looks like a fantastic package that combines a lot of nice features. The writing Reddit in Lisp Movie really sold me on the ease that kpax lets you create pages and sites. I went through half of it myself, typing it in and messing around with the code. I also figured out how to get environment variable which from what I can tell is different in common lisp and sbcl (a bit of a bummer that it isn't portable).

My currently web provider like most doesn't have any sort of support for Lisp. While learning about the best way to get it all up and working I feel the most confident not running a separate process, but just relaunching clisp for each webpage request (i.e. a executable in the cgi-bin directory). Of course if kpax can't be run in that configuration I might sit down and figure out all the details about mod_lisp and how it works. Finally I was told about through a friend a feature in sbcl where it can save all the current scripts into an executable which makes for deploying sbcl cgi-bin apps nice and easy because the webserver wouldn't have to have anything installed.

Lastly Thursday night I skipped ahead in the web chapter in ANSI Common Lisp (chapter 16). I know that Paul Graham has done a lot of Web work and was expecting a real high quality chapter with all sorts of good hints, tips and tricks for making web pages in Lisp. That was about as far away as I could get from what I found. The chapter starts off explaining what a webpage is and how it contains "tags" and doesn't get much better.

So no exercises for this entry, but by messing around I have written some lisp and read much more, but more importantly begun to learn more in general about the tools and packages that are out there. There looks to be a lot of interesting packages out there and I will mess around with them more.

For the next entry we will be back to our regular scheduled entry of chapter four of ANSI Common Lisp.

* PHP is vial and evil for many reason which I don't need to go into here, I am sure that you can find many comprehensive lists of reasons just by Googling.


SETH said...

Hey, thanks for this helpful blog. I too have been trying to go through the Practical Common Lisp book.

One thing though (and I admit that it's nitpicky), I think you mean "vile and evil" instead of "vial and evil."

Slobodan Blazeski said...

Take a look at cl-weblocks
it's still a very young piece of software based hunchentoot, cl-who and continuation passing style but some of the ideas behind it are cool, or at least I think so
also here it is a demo to get some picture
If you need a lisp based provider try some VPS for an experienced linux user it won't be a problem to configure it.
Or talk with folks from they're cool lispers and make the Clozure Cl former OpenMCL, prime open source implementation for Mac.

happy lisping