nuggets

Pattern for smooth SPA development with SWI-Prolog

When developing SPA applications using SWI-Prolog on the backend, Cross-Origin Resource Serving (CORS) can cause you all kinds of bother. In this post we look at how to develop your SPA on a single Origin, like how you’ll serve it in production, so all that bother vanishes away.

Emacs X Window Manager On Raspberry Pi

Emacs was a great operating system, it just lacked a good text editor like Vim. Well times have moved on, now you can use Emacs as your window manager with Vim text editing. Let's try it out on a Raspberry Pi.

The Golog Elevator

Golog is a logic programming language for dynamic domains based in Situation Calculus with an interpreter written in Prolog. The classic example from the book is that of an elevator. Here we present an interactive version of that program.

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.

Python Generators, yield and send

Another little known Python feature that deserves more love. This time we’re looking at the send function that lets you input values into your generator as it’s running. It works through yield and is awesome!