Recently I've taken more of a liking to Chicken Scheme, and started trying to use it for more of my day to day development. Recently I wrote a port (PongClock ) of a JS + HTML5 Pong Clock into Chicken Scheme using the OpenGL + GLUT libraries. I couldn't believe how smoothly it went, since it was a line by line port, the only thing I needed to write myself were the graphics drawing routines, easy enough since we're only dealing with white rectangles after all, but now it functions as a cross platform screensaver (verified on Linux, OSX, and XP!).

But the area I spend most of my time in is web development, so I was pleased to find the Awful framework for Chicken. Despite the name it is anything but. A simple usage example looks like this:

;; Hello World!
(use awful)

(define-page "/"
  (lambda ()
    "Hello, World!"))

Yes, it really is that easy. Of course you'll most likely want to define your own template, and that is really easy to do too, my templates look something like this:

;; Defining a template
(define-syntax define-templated-page
  (syntax-rules ()
    ((_ path body ...)
     (define-page path
       (lambda ()
          (<head> (<title> "Page Title")
                  (<link> rel: "stylesheet" href: "/style.css"))
           (include-javascript "/jquery.min.js")
           (<script> type: "text/javascript"
                     "$(function () {
// jQuery goes here
       no-template: #t))))

Which is then used like this:

;; Templated Hello World!
(define-templated-page "/"
  (<h1> "Hello")
  (<h2> "World!"))

This is a good example of how scheme macros can simplify anything and everything. It has made defining a new page as easy as adding a single line of code.

Combined with DB connectors and a multitude of other awesome libraries, Chicken Scheme and the power of macros really make for a wonderful rapid prototyping environment. With the ability to compile down to a static executable, this is my new favourite method of creating desktop applications that use a browser for presentation.

(Maybe) Related posts: