Posterous theme by Cory Watilo

Pattern Matching

Thanks to the enthusiasm and persistence of Pepijn de Vos (http://twitter.com/pepijndevos), I've tracked down numerous bugs in the Logos implementation of miniKanren. It's a little bit slower now, but finally you should only see programs that never end - not stack overflows.

With that behind us, I wrote some original pattern matching code for miniKanren. miniKanren is a really minimal language so many Prolog programs tend to be overly verbose when translated. With pattern matching, miniKanren programs tend to be about as long as their Prolog cousins. Here's a classic AI example:

I've started a repo where I'll be posting bits and pieces and like this from Bratko's Prolog Programming for Artificial Intelligence converted to miniKanren (https://github.com/swannodette/bratko-logos). This will  be a useful guide on how to convert Prolog programs into Clojure. Eventually I'll write up a proper tutorial for people who haven't spent much time with Logic Programming.

What's next? cond-a and cond-u which allow for pruning (think Prolog cut) were broken from the latest changes. So these will get fixed first. After that I'll be digging into tabling.

On the far horizon - something called Constraint Handling Rules ...

As always you can find the latest here https://github.com/swannodette/logos.