Quickit

After Reddit was rewritten in Python, some Lisp fans got the idea of writing clones of Reddit in Lisp. I don't have many spare cycles right now, and I'm not in the market for a long-term project, so I set myself a slightly different goal: I decided to implement the largest possible subset of Reddit's features that I could within one hour.

I think I did an ok job, considering. One hour passes by rather quickly when you try something like this!

Here's the code:

quickit.asd

package.lisp

quickit.lisp

All the above code is released under the BSD license.

Update: After I put Quickit online, a bug was found: Ranking an article down, and then hitting reload would keep ranking that article down. At first I wasn't going to fix the bug. The whole point of the Quickit was to write a clone very quickly. Fixing bugs at this point felt wrong. But I decided to set myself another challenge: Fix the bug and deploy a patch onto the running Lisp process in less than five minutes... It actually took a little over a minute and a half to fix the bug and push the new code onto the server (without, of course, stopping the Lisp process). The patch (to quickit.lisp) is:

55,56c55,56 < (format out "<a href=http://abstractnonsense.org:8000/rankdown?id=~A><img border=0 src=down.png></a> <a href=\"~A\">~A</a> (score ~A)<br>" < (article-id article) (article-url article) (article-description article) (article-score article))))) --- > (format out "<a href=http://abstractnonsense.org:8000/rankdown?from=~A&id=~A><img border=0 src=down.png></a> <a href=\"~A\">~A</a> (score ~A)<br>" > (article-score article) (article-id article) (article-url article) (article-description article) (article-score article))))) 109c109,110 < (id (second (assoc "id" params :test #'equalp)))) --- > (id (second (assoc "id" params :test #'equalp))) > (from (second (assoc "from" params :test #'equalp)))) 111,112c112,114 < (article (find nid articles :key #'article-id))) < (when article --- > (article (find nid articles :key #'article-id)) > (nfrom (parse-integer from :junk-allowed t))) > (when (and article from (= (article-score article) nfrom))

I also moved Quickit from abstractnonsense.org to abstractnonsense.com (actually the same machine) because my dyndns entry for abstractnonsense.org mysteriously stopped working... again, I did this without having to stop the process or lose any of the saved state.