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.

Failing a Generator on First Failure

There are occasions when working with some generative predicate where you don't know when you need to quit the generation until some condition fails. Trouble is, you'll fail with no chance of future success but you're now lost in an infinite loop as the generator keeps on trying. In this post we'll work through a blog pagination example and show how to use a dirty little trick with a cut.

Basic Idea Of Recursion

Want to do something a bunch of times in Prolog? Recursion is how we do it. In this post we'll look at the most basic ideas of recursion and talk through a couple of examples.

"Hello, Tau Prolog!"

Imagine an internet where you didn't need to write JavaScript… Imagine an internet where you could write Prolog… Imagine no more, write Tau Prolog!

Predicates vs Functions

People from other languages often get a little confused with these predicate things, especially as their syntax looks similar to functions in other languages. In this post we contrast predicates and functions and demonstrate the advantage of using predicates over functions.

Prolog Partial Predicates

Did you know you can call partial predicates with arguments added later on? This is how many of the higher order predicates like `maplist` work. But you can take advantage of this too! Let's take a look at `call`.

Prolog: Forwards and Backwards

A key idiom in Prolog is the idea that it runs both forwards and backwards. If you've never programmed in Prolog before, this can be mind-blowing! You can write one "function" and get many different uses out of it. In this post we'll take a look at what this means as a teaser that might tempt you into giving Prolog a go.

Homoiconic Prolog: Explain yourself!

Prolog is rather popular for Expert Systems. Why? Well because it's homoiconic and because we have DCG's, we can reify a query to make it explain itself. That's a lot of jargon, in this post we'll break it down and make some explanations.