lispcommon-lisp

Simplest way to get a Lisp "hello world" web application going


I want to write a Lisp web application just for fun. I found this question about Lisp web apps but all the answers seem so complicated. After looking into the links provided in the answers, the solutions seem really complicated.

If I just want a simple, "hello world" Lisp web app, is there not a simple way to do it?


Solution

  • This answer LOOKS complicated, but I think that getting a simple Lisp web app up and running is going to be easier than learning the other more awesome bits of Lisp anyway, so it's probably worth it.

    There's a couple of really great Common Lisp books with intro-to-web-app chapters: Practical Common Lisp and Land of Lisp.

    There's a chapter in Land of Lisp which covers building a simple web server using sockets. It's pretty rudimentary, but I think would serve as a great starting point for a "hello world" type of Lisp app.

    The chapter in Practical Common Lisp is at a higher level, and works with a full-fledged server called Allegro Serve. There are later chapters which build an MP3 streaming app.

    Practical Common Lisp is available for free, here's the chapter of interest: http://gigamonkeys.com/book/practical-web-programming-with-allegroserve.html

    I think both books are great resources for starting out with Common Lisp (as someone who's just starting out myself), although Land of Lisp is a bit more accessibile and more fun, although it does cover some interesting problems like lazy evaluation and searching game trees. Practical Common Lisp is more... practical, but that's not really a bad thing. It's aimed at professional programmers so its tone is just a little more serious.

    One word of warning:

    AFAIK Common Lisp doesn't have a really standard way of doing network programming, so this is one area of Lisp learning where you start to run into problems if you don't pick the same implementation as the book you happen to be reading.

    Land of Lisp uses CLisp throughout, but you can use SBCL if you follow along with this blog post nearby: http://blog.ciaranbradley.com/crossing-the-streams-land-of-lisp-chapter-12-0

    Practical Common Lisp uses Allegro Serve as I said, and I think there is a version of Allegro Lisp available from their site for use with the book. However, you can also use Portable Allegro Serve. Be careful if you are using Mac OS X and SBCL (as I am): SBCL's thread support is experimental on OS X, so if you go that route, the best bet is to install Ubuntu in a VM and then apt-get install sbcl and do your Allegro Serve programming in there, where SBCL threads are better supported. Maybe some CL wizards can suggest some other tips here. That's just what worked for me.