Prolog

Architecture Considerations for Prolog

Software architecture is a tricky subject at the best of times, often mitigated by following a framework. However, when you find yourself in the wilds of Prolog, there’s not much guidance out there, and not many templates to follow. In this post, I’ll provide some guidance built on the principal of substitution.

Rock, Paper, Scissors, Prolog!

Simple, classic games like Rock, Paper, Scissors are good to code when learning a new language. The lovely thing about making this game in Prolog is you’re just encoding what it is, not how it is. It’s a subtle difference, but I’ll point it out during this explanation.

Getting JSON data from an API in SWI-Prolog

Some folks don’t make their data available through RDF formats, or nice SPARQL endpoints, instead they provide a (REST/RESTFUL) API and will return JSON data for your request. It can be a little tricky figuring out how to get this data into your SWI-Prolog program. So in this post I demonstrate with a simple example.

Setting Up Unit Testing In SWI-Prolog

Reading the docs for plunit, it can be quite tricky to figure out how to setup a nice unit testing environment and actually run those tests. In this post I demonstrate how I do it, keeping my tests separate from my code, and running them with a handy command.