1 Comment

Clojure Conj 2012: Logic Programming, ClojureScript, and the Importance of Small Services

The third Clojure Conj, a conference dedicated to the Clojure community, was held in Raleigh, NC the second weekend in November. I was in attendance, along with fellow atoms Drew Colthorp and Scott Vokes.

For those unaware, Clojure is a modern dialect of Lisp that was built on top of the Java Virtual Machine. Clojure, being a relatively young language, still has a nascent, close-knit community of talented computer scientists.

Logic Programming

One of the major themes at this year’s conference was logic programming. Nearly a third of the talks involved logic programming in some regard. Some were more esoteric than others, such as William Byrd and Daniel Friedman’s talk about writing logic to find examples of quines (even multiquines!) in Scheme. Another talk by Daniel Gregoire showed a practical side of logic programming by using it in web tests, e.g., expressing your test as logical requirements, rather than imperatively.

In logic programming, rather than directly instructing the computer how to solve a problem, you provide a set of logical rules or constraints. The solution engine will then take these constraints and finds some or all values that satisfy all constraints. Behind the scenes, the logic engine uses techniques such as backtracking and constraint propagation. For example, if you specify that:

  • x is an integer between 1 and 100
  • x is divisible by 3
  • x is divisible by 7

Then the solution engine would return (21 42 63 84).

Logic programming isn’t new, tracing back to Prolog and earlier languages. Despite this, it’s new to Clojure and thanks to the core.logic library.

ClojureScript

The second strong theme of the conference was ClojureScript. Despite only being a year old, it’s gained significant mindshare and matured significantly. Chris Granger’s LightTable, for example, is built entirely in ClojureScript, manipulating an HTML DOM for its user interface.

Conrad Barksi’s talk introduced Webfui, a library for representing the DOM as Clojure data and allowing manipulation by mutating the data directly. Later, Bodil Stokke live-coded a To-do app using ClojureScript and Catnip on top of Node.js and Express.

By far, the biggest caveat is that ClojureScript isn’t self-hosting yet, and still requires some JVM-based tools, which unfortunately leads to long compile times waiting for the virtual machine to bootstrap.

Rich Hickey’s Keynote

Rich Hickey’s keynote focused on building robust software achieved by writing small, single-focus applications that use network message sending and proper error handling. Rich also made the point that it’s more beneficial to the Clojure community to focus on writing these services than to spend time writing libraries. While libraries are important, Clojure is especially well-suited to writing small, functional services, and writing these makes it much easier to integrate Clojure in with existing infrastructure and thus gain traction.

Coincidentally, some of Rich’s keynote reminded me of Scott Vokes’ recent spin post, Message Oriented Programming.

Miscellaneous Notes

There were a number of other fascinating and unique presentations, including:

  • A novel implementation of Tail Call Optimization in Clojure, presented by Chris Frisz.
  • Ambrose Bonnaire-Sergeant presenting his work developing a typed version of Clojure, inspired by Typed Racket.
  • Numerous live-coding sessions that were refreshingly well-done and entertaining.
  • An excellent session by Chris Ford, where he introduced the concepts of music theory via functional programming.