Lisp movies

Here’s a page (from a blog that’s on my blogroll) which links to two screencasts that show using LispWorks (a Common Lisp implementation on the Mac with a nice IDE) to do HTTP client and server stuff and then to develop a Reddit-like web site in around 20 minutes.

I think these would be very impressive for someone who is a die-hard C/C++ coder
and who hasn’t played around much with Python, Ruby, etc. They are probably less impressive to the Python and Ruby crowd or to people who have watched screencasts for Ruby on Rails, Django, TurboGears, etc. Or the campy Erlang movie.

The main thing that is shown in these videos is the fluidity of developing in Lisp – the ability to make a change and see it right away without a lengthy compile/link. This of course is nice but is not unique to Lisp. There are also some neat things shown regarding the LispWorks IDE, but these have more to do with the IDE than with the Lisp language. The thing that is shown that seems most unique to Lisp is the seamless embedding of the HTML generation in the code via the clever use of s-expressions. On the other hand, the value of doing this is questionable as this is essentially throwing out the concept of separating presentation from logic and making it impossible to farm the web design out to the Dreamweaver crowd.

One interesting thing I noticed is that it was easy for me to follow along and to understand the code as he was writing it, but in the end the code had the quality that Lisp has for me – that is, the meaning of it does not leap off the page. I can follow it, but only after mentally parsing the indentation while ignoring the wash of parentheses and internally translating the flet‘s and mapcar‘s.

So while I like the whole rapid prototyping, incremental development vibe illustrated here, I still feel like I’d rather do it in a different language.

Sorry, no red pill for me just yet.

links for 2007-03-04

Common Lisp libraries for Yahoo! APIs

I was reading some essays about Common Lisp and came across a few interesting libraries for accessing some of Yahoo’s Web Services APIs:

In the case of cl-delicious, it was a little harder to install (into SBCL on my Ubuntu Edgy system), as the author’s site has a bzipped file instead of the gzipped file that ASDF-Install expects.

~/.sbcl/site$ wget
~/.sbcl/site$ tar -xjf cl-delicious-0.1.tar.bz2
~/.sbcl/site$ cd ../systems
~/.sbcl/systems$ ln -s ~/.sbcl/site/cl-delicious/cl-delicious.asd .

Now, at this point, I was running the current SBCL version from the Ubuntu Edgy repository and this version of SBCL seems to have a slight problem with the cl-delicious.asd file so I had to do:

~/.sbcl/systems$ vim cl-delicious.asd .     # Remove the line with LICENSE

It seems that upgrading to the release version of SBCL from the SBCL web site (1.0.2 as of this writing) also solves the problem and is perhaps a preferable solution.

and then

~/.sbcl/systems$ sbcl

or if you prefer, fire up Emacs and SLIME.

and then

CL-USER> (asdf:operate 'asdf:load-op 'cl-delicious) 
...(a bazillion messages about loading and registering)...

and now you’re ready to do stuff, as shown in the cl-delicious page:

CL-USER> (in-package :cl-delicious)
CL-USER> (defparameter *du*                                                                                                    
           (make-instance 'delicious-user                                                                                      
                          :username "user"                                                                                     
                          :password "password"))
CL-DELICIOUS> (recent-posts *du* :count "2")
    :HREF ""
    :DESCRIPTION "Daniel P Friedman: A Celebration"
    :HASH "9821f03f10279cad407aa8b2e5c2bef1"
    :TAG "programming video"
    :TIME "2007-02-22T23:06:22Z")
    :HREF ""
    :DESCRIPTION "Online texts"
    :HASH "79b0c74c3d2941dbd57ac922b471e781"
    :TAG "math books"
    :TIME "2007-02-22T20:50:26Z"))

It was easier to install cl-yahoo.

CL-USER> (asdf-install:install 'cl-yahoo) 

However, I ran into problems getting Web search to work:

CL-USER> (asdf:oos 'asdf:load-op :cl-yahoo)                                                                                    
CL-USER> (use-package :cl-yahoo)                                                                                               
CL-USER> (ysearch :web :query "lisp" :type 'any :results 2)
XML parser encountered eof before end of entity.                                                                               
   [Condition of type S-XML:XML-PARSER-ERROR]                                                                                  
 0: [ABORT] Return to SLIME's top level.                                                                                       
 1: [TERMINATE-THREAD] Terminate this thread (#)                                               
  0: (S-XML::RESOLVE-ENTITY                                                                                                    
      #<SB-SYS:FD-STREAM for "a constant string" {B477469}> >                                                                  
      "invalid value: uri -"                                        
      #<HASH-TABLE :TEST EQUAL :COUNT 6 {B47C031}>                                                                             
     <!-- uncompressed Sat Mar  3 16:16:03 PST 2007 -->                                         > 
  1: (S-XML::PARSE-TEXT                                                                                                        
      #<SB-SYS:FD-STREAM for "a constant string" {B477469}>

I guess I’ll email the author about that.

Lisp: UnCommon Web framework now easily installable

A few months ago, while I was on a Lisp kick, I looked into installing and trying the UnCommon Web framework but I was put off on how difficult it was to install.

Well, it looks like some folks have worked to make it easy to install. At this nice page, they offer a UCW “boxset”, which you untar and it has everything you need to get going. I tried it and it worked like a charm with sbcl on Ubuntu. The same page offers a tutorial, which looks good, but I haven’t tried it yet.