Wednesday, January 25, 2012

Finite State Machines in core.logic

This is an implementation of Finite State Machines in Clojure using core.logic. They are a good starting point for computational linguistics and illustrate several features of core.logic, such as various ways of defining new relations, pattern matching and also the invertibility of relations.

It is not an introduction to core.logic. To learn the basics, I would recommend the Logic Starter.


  1. Awesome! Reading about logic programming is always enlightening - thanks for this.

    One teeny weeny bug: in the formal comment of the state machine you define the first transition fn as `delta(ok, a) = a;` when it probably should be `delta(ok, a) = ok;`

  2. Good spot, fixed. Glad to hear somebody actually reading the Maths :).