Atomic Object’s blog on everything we find fascinating.

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.

The main caveat right now is that there are no macros. Maybe before Clojure/West we (or somebody else) will have macros working so it can be fully self-hosting. Also, in order for this to make it back into the upstream code-base we’ll really need Feature Expressions first: http://dev.clojure.org/display/design/Feature+Expressions

Comments are closed.

Atomic does more than talk about software. We also make it — for clients large and small in all kinds of industries.