Menu:

Post History:

Animals Matter to Me

Yes, I use Prolog and I like it

In the last couple of weeks I have been able to come back to doing some Prolog development at work after a very long break from it. I didn’t realize it before but my feelings toward writing Prolog code had been somewhat negatively affected by our troubles deploying Rails apps that call a particular Prolog interpreter. I had forgotten that I actually do really enjoy writing Prolog code. Here’s some quick thoughts on why I enjoy it and on a new project I’m starting where I hope to elaborate on these points.

Can be very fast

The code I have been maintaining lately is a scheduler. Although the data goes through a lot of processing before it reaches the Prolog code, the scheduler itself runs very fast. It can return a schedule for a consistent constraint network of hundreds of nodes in under a second.

Easy to gather data

A number of times the Rails side of our application required new information from the Prolog side. We have a clear, agreed upon API to call and return results between the two, and it was very easy to write new code to calculate and gather the extra information and make it part of our API for returning data.

Easily handles different cases

The system of backtracking used in Prolog lets the programmer describe any number of situations and what to do in each of them and the Prolog interpreter does the work of finding which apply to the current data.

Reliable

Of course it is possible to write buggy code in any language, but part of the good vibes I have for Prolog stem from the reliability of this particular work project. After the initial development the code was, and continues to be, very reliable (ignoring our deployment issues which weren’t related to the code itself). While the Ruby code calling Prolog changed and added features, only minor tweaks in the Prolog code were required for well over a year.

A modern Prolog site

From searches and blog monitoring, it is clear that Prolog gets little to no love, even in this time of open mindedness and people learning new and varied languages. I think part of that comes from the fact that Prolog’s main usage has not been in areas that a lot of people are interested in. I’ve written schedulers and theorem provers in Prolog, but not many small, useful apps or just something thrown together for fun.

To hopefully start discussions on this type of Prolog programming, and to highlight more accessible Prolog coding, I have started working on http://prologblog.com. The first posts I plan to make there will be about writing the site’s own blog application in Prolog itself.

0 comments


Adding new comments is currently disabled.